Hello All
when doing the following type of thing
$ErrorActionPrefference="Continue"
foreach ($Computer in $Computetlist) {
try {
get-wmiobject win32_bios -computername $computer
}
catch {some code here}
}
I get the odd RPC failure and Access denied which I am not concerned about. However there are a couple of computers I have come accross where the above command just sticks forever i.e. no error, no console output. The computer in qustion is pingable etc, so not sure what the WMI issue is at the moment. Plus the catch block is not implemented i.e. is really waits forever (well the 30 odd minutes I was prepared to wait anyway).
therefore I would like to do is rap a command around the try/catch construct to say if the next command (or commands) take longer than x seconds "continue" i.e. move on to the next item in the foreach.
Is this possible please?
Thanks
Ernie
↧
Is there a way to set a time limit on an individual powershell command
↧