根据这里的文件,星号通配符是支持的,因此它应该在例如。
* [EventData [Data [@Name ='TargetUserName'] ='User1 *']]
但我不能得到任何通配符filter工作 – 有人能够做到这一点?
XPathselect器必须以*开头,但是由于Xpath 1.0没有contains运算符,所以不能使用*来过滤字段。
XPath 1.0限制:Windows事件日志支持XPath 1.0的一个子集。 在查询中有什么function是有限制的。 例如,您可以在查询中使用
position,Band和timediff函数,但其他函数(如starts-with和contains目前不受支持。
使用Powershell
Get-EventLog -LogName "System" | ?{$_.Message -like "*YourSearchString*"} | Out-GridView