jra*_*ara 4 powershell powershell-2.0
我正在尝试从GetEventlog中获取选定的对象
$StartDay = (Get-Date).AddDays(-1)
Get-EventLog -LogName application -After $StartDay | Select-Object Time, EntryType, Source, Message
Run Code Online (Sandbox Code Playgroud)
但这会产生时间字段为空列而没有数据.如何格式化时间字段来显示数据?
CB.*_*CB. 11
属性TIME不存在,您可以使用TIMEWRITTEN或TIMEGENERATED:
Get-EventLog -LogName application -After $StartDay | Select-Object Timegenerated, EntryType, Source, Message
Run Code Online (Sandbox Code Playgroud)
尝试使用此命令可以查看所有属性:
(Get-EventLog -LogName application -After $StartDay )[0] | fl * #format-list
Run Code Online (Sandbox Code Playgroud)
要么
(Get-EventLog -LogName application -After $StartDay )[0] | gm #get-member
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6157 次 |
| 最近记录: |