I have a script which is getting hung and not able to proceed to next commandline
Below is the script
$ST = new-object -com schedule.service
$Server = "Server1"
$M = $ST.GetFolder("\").GetTask("GWSTSAutoPatch")
It gets hung on $ST.GetFolder("\").GetTask("GWSTSAutoPatch") and wont proceed into next command.
Now , question is , Can I add a timeout on this? so , that script will wait for few sec and it will proceed if it does not get any response.