Member of local administrators group from multiple servers in csv


team,

i found script:

-------------

invoke-command {
$members = net localgroup administrators | 
 where {$_ -and $_ -notmatch "command completed successfully"} | 
 select -skip 4
new-object psobject -property @{
 computername = $env:computername
 group = "administrators"
 members=$members
 }
} -computer chi-fp01,chi-win8-01,chi-ex01 -hidecomputername | 
select * -excludeproperty runspaceid

---------

question - above computer name inserted manually, got 1000+ servers copied in csv, have command modified call csv file input -computer variable.

thanks


inderjit

try one:

https://gallery.technet.microsoft.com/scriptcenter/gather-local-group-0d0a85ad

call this:

$servers = get-content servers.lst $path    = "c:\temp\serverlst_output.csv"  get-remotegroupmembership -computername $servers | export-csv -path $path -notypeinformation



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file