You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
3.4 KiB
107 lines
3.4 KiB
# 尝试创建一个名为 "wineventlog" 的目录
|
|
try {
|
|
New-Item -ItemType "directory" -Path "wineventlog"
|
|
}
|
|
catch {
|
|
# 如果创建目录失败,输出错误信息
|
|
echo "can't create a new directory"
|
|
}
|
|
|
|
# 尝试导出安全日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl Security wineventlog/Security.evtx
|
|
}
|
|
catch {
|
|
# 如果导出安全日志失败,输出错误信息
|
|
echo "Can't retrieve Security Logs"
|
|
}
|
|
|
|
# 尝试导出系统日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl System wineventlog/System.evtx
|
|
}
|
|
catch {
|
|
# 如果导出系统日志失败,输出错误信息
|
|
echo "Can't retrieve System Logs"
|
|
}
|
|
|
|
# 尝试导出应用程序日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl Application wineventlog/Application.evtx
|
|
}
|
|
catch {
|
|
# 如果导出应用程序日志失败,输出错误信息
|
|
echo "Can't retrieve Application Logs"
|
|
}
|
|
|
|
# 尝试导出 Windows PowerShell 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl "Windows PowerShell" wineventlog/Windows_PowerShell.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 Windows PowerShell 日志失败,输出错误信息
|
|
echo "Can't retrieve Windows PowerShell Logs"
|
|
}
|
|
|
|
# 尝试导出 Microsoft-Windows-TerminalServices-LocalSessionManager/Operational 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl "Microsoft-Windows-TerminalServices-LocalSessionManager/Operational" wineventlog/LocalSessionManager.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 LocalSessionManager 日志失败,输出错误信息
|
|
echo "Can't retrieve Microsoft-Windows-TerminalServices-LocalSessionManager/Operational Logs"
|
|
}
|
|
|
|
# 尝试导出 Microsoft-Windows-Windows Defender/Operational 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl "Microsoft-Windows-Windows Defender/Operational" wineventlog/Windows_Defender.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 Windows Defender 日志失败,输出错误信息
|
|
echo "Can't retrieve Microsoft-Windows-Windows Defender/Operational Logs"
|
|
}
|
|
|
|
# 尝试导出 Microsoft-Windows-TaskScheduler/Operational 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl Microsoft-Windows-TaskScheduler/Operational wineventlog/TaskScheduler.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 TaskScheduler 日志失败,输出错误信息
|
|
echo "Can't retrieve Microsoft-Windows-TaskScheduler/Operational Logs"
|
|
}
|
|
|
|
# 尝试导出 Microsoft-Windows-WinRM/Operational 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl Microsoft-Windows-WinRM/Operational wineventlog/WinRM.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 WinRM 日志失败,输出错误信息
|
|
echo "Can't retrieve Microsoft-Windows-WinRM/Operational Logs"
|
|
}
|
|
|
|
# 尝试导出 Microsoft-Windows-Sysmon/Operational 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl Microsoft-Windows-Sysmon/Operational wineventlog/Sysmon.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 Sysmon 日志失败,输出错误信息
|
|
echo "Can't retrieve Microsoft-Windows-Sysmon/Operational Logs"
|
|
}
|
|
|
|
# 尝试导出 Microsoft-Windows-PowerShell/Operational 日志到指定的 EVTX 文件
|
|
try {
|
|
wevtutil epl Microsoft-Windows-PowerShell/Operational wineventlog/Powershell_Operational.evtx
|
|
}
|
|
catch {
|
|
# 如果导出 PowerShell Operational 日志失败,输出错误信息
|
|
echo "Can't retrieve Microsoft-Windows-PowerShell/Operational Logs"
|
|
}
|
|
|
|
# 尝试压缩 "wineventlog" 目录为 logs.zip
|
|
try {
|
|
Compress-Archive -Path wineventlog -DestinationPath ./logs.zip
|
|
}
|
|
catch {
|
|
# 如果压缩失败,输出错误信息
|
|
echo "couldn't compress the log folder"
|
|
} |