This Powershell script can detect the members of a remote machine's local Admins group.

The script utilises WMI and powershell to query and return all the members of the local "Administrators" group on a remote machine name.

The script can also be amended to enumerate any other groups on a remote machine for querying members

Usage: get-localadmin "Server FQDN"

e.g. Get-LocalAdmin


function get-localadmin {  
param ($strcomputer)  
$admins = Gwmi win32_groupuser –computer $strcomputer   
$admins = $admins |? {$_.groupcomponent –like '*"Administrators"'}  
$admins |% {  
$_.partcomponent –match “.+Domain\=(.+)\,Name\=(.+)$” > $nul  
$matches[1].trim('"'+ “\” + $matches[2].trim('"')