Hello all,
I am verifying operating systems on the network and I can do a
(Get-WMIObject Win32_OperatingSystem -computername comp1).name
everything works fine. I can gather the OS of each machine if I do them one at a time. When I try to do the following foreach, it fails.
$computerlistfile = "C:\complist.txt" $computerlist = Get-Content $computerlistfile -ErrorAction SilentlyContinue foreach($computer in $computerlist){ Write-Output $computer | Out-File -append C:\OSlist.txt (Get-WMIObject win32_operatingsystem -computername $computer).name | out-file -append C:\OSlist.txt}
When I try and execute via the foreach I get a return of a "The RPC server is unavailable" but then I can verify each computer individually. I have tried to break it down line by line to see if a path was incorrect or something, everything checked out until the actual gwmi. Any help is appreciated.
Thanks,
Paul