我正在尝试从事件日志输出中提取部分消息。
我运行了以下命令:
$filterXml = ‘<QueryList>
<Query Id="0" Path="atm">
<Select Path="atm">*[System[(Level=2)]]</Select>
</Query>
</QueryList>’
$event = Get-WinEvent –FilterXml $filterXml
我正在使用不同的方法通过运行以下命令来获得所需的输出,但没有一个能正常工作。也许我没有尝试并完美地解决它。
$event.Message.Substring(56,139)
$event.Message.split(":")
$event =
[int]($event.message | Select-String "jobId").Matches.Groups[2].Value
我的输出:
Message: Shell.SmartM.atm.Service.atmServiceException: {jobId:38895,name:All Reports: Kiran, Kumar,reportConfigurationId:1805
0,status:Error} --- Shell.SmartM.atm.Service.DataException: An error occurred while attempting to retrieve data from system. --- System.InvalidOperationException: Request to system failed with status code NotFound --- System.Exception: {Errors:[An exception has occurred. Please contact your
System administrator for help in enabling debug mode.]} .....
App Domain: /LM/W3SVC/2/
ProcessId: 3696
Win32 ThreadId: 5536
Extended Properties:
UserId: LOCALHOST
我正在尝试从上述输出中获取值
jobid:
name:
Shell.SmartM.atm.Service.DataException:
System.InvalidOperationException:
System.Exception: {Errors: