From a security standpoint, you may be asked to determine who has administrative access across a farm/multiple servers across the enterprise. Using the below, you ‘ll be able to generate that list with ease:

Open a servers.txt file and place your servers in the list and save. Next you’ll paste the below in a .ps1 file. Now call the .ps1 script and review the results.txt

$Result = @()
foreach($server in (gc .\servers.txt)){
$computer = [ADSI](”WinNT://” + $server + “,computer”)
$Group = $computer.psbase.children.find(”Administrators”)
function getAdmins
{$members = ($Group.psbase.invoke(”Members”) | %{$_.GetType().InvokeMember(”Adspath”, ‘GetProperty’, $null, $_, $null)}) -replace (‘WinNT://DOMAIN/’ + $server + ‘/’), ” -replace (‘WinNT://DOMAIN/’, ‘DOMAIN\’) -replace (‘WinNT://’, ”)
$members}
$Result += Write-Output “SERVER: $server”
$Result += Write-Output ‘ ‘
$Result += ( getAdmins )
$Result += Write-Output ‘____________________________’
$Result += Write-Output ‘ ‘
}
$Result > .\results.txt
Invoke-Item .\results.txt