Skip to content

Instantly share code, notes, and snippets.

@manualbashing
Last active June 7, 2019 10:30
Show Gist options
  • Save manualbashing/374307ea41112a20ca87 to your computer and use it in GitHub Desktop.
Save manualbashing/374307ea41112a20ca87 to your computer and use it in GitHub Desktop.
Use cim to find local admin accounts on a Windows system.
Get-CimInstance -ClassName win32_group `
-Filter "Name LIKE 'admin%' AND Domain = '$env:COMPUTERNAME'" |
Get-CimAssociatedInstance -Association win32_groupuser |
Select-Object -ExpandProperty Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment