I am still trying to adjust to powershell after a couple of days playing around with it.
I have the following question regarding invoke-command. My scenario is this: I am trying to make use of the invoke-command and its ability to "thread" to multiple computers at once when we pass a list of computers to it:
$ipList=@()
invoke-command $ListOfComputers -ScriptBlock {
#do something, following is an imaginary cmdlet
$ipList+=get-ip-of-machine
}
I want to keep track of which of those computers it can not connect to. Is there a way to catch those exceptions? Or would i have to connect to one computer at a time and, test-connection and perhaps have invoke-command run as a job to make it faster?
try {} catch {}
didn't seem to work.