Last active
August 23, 2017 16:25
-
-
Save watson0x90/3f934a11bc320e29047b3bc1f93486b8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $hostlist = "","" | |
| $userSearch = "" | |
| $ErrorActionPreference = "SilentlyContinue" | |
| function Invoke-QueryDowngrade{ | |
| $downgradeXML = @" | |
| <QueryList> | |
| <Query Id="0" Path="Security"> | |
| <Select Path="Security"> | |
| *[System[EventID='4768']] | |
| and | |
| *[EventData[Data[@Name='TargetUserName'] != 'ANONYMOUS LOGON']] | |
| and | |
| *[EventData[Data[@Name='TargetUserName'] = '$userSearch']] | |
| and | |
| *[EventData[Data[@Name='ServiceName'] = 'krbtgt']] | |
| and | |
| *[EventData[Data[@Name='TicketEncryptionType'] = '0x17']] | |
| </Select> | |
| </Query> | |
| </QueryList> | |
| "@ | |
| foreach($hostName in $hostlist){ | |
| "==== Querying Host: $hostname ====" | |
| $result = Get-WinEvent -FilterXml $downgradeXML -ComputerName $hostName | |
| if($result){ | |
| $result | Format-List | |
| }else{ | |
| "No Result or unable to query" | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment