Skip to content

Instantly share code, notes, and snippets.

@Purp1eW0lf
Created April 4, 2022 10:22
Show Gist options
  • Save Purp1eW0lf/6ea822dfd0c452c8666d4dff54ab32f4 to your computer and use it in GitHub Desktop.
Save Purp1eW0lf/6ea822dfd0c452c8666d4dff54ab32f4 to your computer and use it in GitHub Desktop.
# stupid overengineered solution
$ErrorActionPreference= 'silentlycontinue';
$value = gp "REGISTRY::HKEY_USERS\*\Software\Sysinternals\PsExec";
$SID = $value.PsPath -split '\',4,'SimpleMatch' | select-string -pattern "S-" | % { $_.Line }
$NAME = gwmi win32_useraccount | ? SID -match $SID | select -expandproperty Name;
if ($value.EulaAccepted -eq 0){} else { write-host -NoNewline "`n Registry confirms PsExec used by "; write-host "$Name`n" -ForegroundColor magenta}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment