Created
April 18, 2019 04:57
-
-
Save xillwillx/f606d69f57835bf55993eca3a54af7f8 to your computer and use it in GitHub Desktop.
list local admin accounts
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
$admins = Gwmi win32_groupuser –computer 127.0.0.1;$admins = $admins |? {$_.groupcomponent –like '*"Administrators"'}; $admins |% {$_.partcomponent –match “.+Domain\=(.+)\,Name\=(.+)$” > $nul;$matches[1].trim('"') + “\” + $matches[2].trim('"') | Select-Object @{Name='Account Name';Expression={$_}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment