Resume in PowerShell 5.1 if exe doesn't finish

44 Views Asked by At

I am using a loop (ForEach-Object) in a PowerShell script to connect to different hosts via plink (PuTTY).

plink -ssh $_ -l $user -pw $password -T -batch $command

$_ is the IP address of the host.

The command does an upgrade on the remote host. After the upgrade, the remote host reboots, but the connection doesn't close. So plink/PowerShell waits endlessly. How can I get PowerShell to resume the script?

1

There are 1 best solutions below

0
Martin Prikryl On

You will find dozens of other questions here for both approaches.