【发布时间】:2018-01-05 13:52:24
【问题描述】:
我可以知道如何将此脚本正确导出为 CSV 吗?
Try {
Invoke-Command -scriptblock {Get-EventLog System -After "7/8/2017" -Before "07/28/2017" |
Where-Object {$_.EventID -eq "50" -or $_.EventID -eq "51" -or $_.EventID -eq "55" -or $_.EventID -eq "57" -or $_.EventID -eq "6008"} |
FT -Property Machinename, TimeWritten, EntryType, Source, EventID, Message -AutoSize -wrap } -computername $computer -ErrorAction Stop
}
Catch {
Write-Host $Computer "Error/RDC Problem" -ForegroundColor Red
}
【问题讨论】:
-
“无法正常工作”是什么意思?我希望 Format-Csv 输出对象的所有属性,而 Format-Table 通常会显示适合屏幕的子集。 Format-Csv 将采用一种不受屏幕宽度限制的格式,因此它可以(并且应该)包含所有内容。
标签: windows powershell csv server