Парсинг логів термінального сервера –
1 2 3 4 5 6 7 8 9 10 |
$RDPAuths = Get-WinEvent -LogName 'Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational' -FilterXPath '<QueryList><Query Id="0"><Select>*[System[EventID=1149]]</Select></Query></QueryList>' [xml[]]$xml=$RDPAuths|Foreach{$_.ToXml()} $EventData = Foreach ($event in $xml.Event) { New-Object PSObject -Property @{ TimeCreated = (Get-Date ($event.System.TimeCreated.SystemTime) -Format 'yyyy-MM-dd hh:mm:ss K') User = $event.UserData.EventXML.Param1 Domain = $event.UserData.EventXML.Param2 Client = $event.UserData.EventXML.Param3 } } $EventData | FT |