Skip to content

Instantly share code, notes, and snippets.

@watson0x90
Last active August 23, 2017 16:25
Show Gist options
  • Select an option

  • Save watson0x90/3f934a11bc320e29047b3bc1f93486b8 to your computer and use it in GitHub Desktop.

Select an option

Save watson0x90/3f934a11bc320e29047b3bc1f93486b8 to your computer and use it in GitHub Desktop.
$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