Get-WinEvent コマンドの次のコマンドは機能します。
パワーシェル:
Get-WinEvent -FilterHashtable @{Logname=’application’;StartTime="2018-04-20 00:00:00";EndTime="2018-04-20 23:59:59"}
コマンド:
powershell.exe -noprofile -command "Get-WinEvent -FilterHashtable @{Logname=\"application\";StartTime=\"2018-04-18 17:42:56\";EndTime=\"2018-04-19 17:43:01\"}"
私が直面している問題は、結果をパイプして特定の RecordID を取得しようとすると、PowerShell で機能することです。
Get-WinEvent -FilterHashtable @{Logname=’application’;StartTime="2018-04-20 00:00:00";EndTime="2018-04-20 23:59:59"} | ? {$_.RecordId -eq 293116} | Select Message
cmd 呼び出しに同じものを追加しようとすると、結果が返されません。
powershell.exe -noprofile -command "Get-WinEvent -FilterHashtable @{Logname=\"application\";StartTime=\"2018-04-18 17:42:56\";EndTime=\"2018-04-19 17:43:01\"} | ? {$RecordId -eq 293116} | Select Message"
?
をWhere-Objectに置き換えて、-property
CMD 文字が誤って解釈される問題を除外しようとしました。ここで明らかな何かが欠けているように感じます。