英語が下手でごめんなさい。
PowerShellとイベント転送メカニズムに問題があります。私はこのようなことをしようとしています:
$remoteComputer = "."
$session = New-PsSession $remoteComputer
Unregister-Event CatchEvent -ErrorAction SilentlyContinue
Invoke-Command $session {
## The WMI query to detect a stopping service
$query = @"
SELECT *
FROM __instancecreationevent
WHERE TargetInstance ISA 'Win32_NtLogEvent'
and targetinstance.eventcode = '7036'
"@
Register-WmiEvent -Query $query "CatchEvent" -Forward
}
$null = Register-EngineEvent CatchEvent -Action { $GLOBAL:MyEvent = $event}
$ MyEvent変数には、最終的にイベント情報ではなく、system.stringクラスデータが含まれます。 代替テキストhttp://eosfor.fileave.com/powershell.png
このスクリプトの何が問題になっていますか?