希望创建一个PowerShell脚本,该脚本可以检查任务调度程序的Windows事件查看器日志。
特别是以PROD_和DEV_开头的任务
有没有办法对此使用通配符?
谢谢,
Shane
最简单的方法是过滤Get-WinEvent结果的Message
属性:
Get-WinEvent -LogName 'Microsoft-Windows-TaskScheduler/Operational' |
Where message -match 'PROD_|DEV_'
只需使用-like
或任何其他比较运算符。
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_comparison_operators?view=powershell-7