#I am new to powershell # Trying to get memory usage information of few servers. I was able to get the result for few servers and not for few others(i get "RPC server unavailable" error) I'm guessing that's a firewall issue and i'm ok with that but i need the list of servers that the command failed to run. I tried to run below "script" with no luck.
You can use $WMI to use that data later on, but if it fails it writes the computer name and the error to the screen. You can take Write-Host and change that to something like this to output to a log file:
"$a failed with error: $_" | Out-File $path -append