title: Execute statement with timeout?
body: <p>Running into a problem using <code>Invoke-WmiMethod</code> in a script, which when run against some computers just hangs. What I'd like to do is execute the command and if it does not return within some defined period of time (say 60 to 120 sec's) then move on (logging the bailout to a file as well.) The only way I currently know to try to do this is using the <code>-AsJob</code> parameter; however, when I try that, the spawned job immediately fails (even against computers where the <code>Invoke-WmiMethod</code> statement is working without the <code>-AsJob</code> parameter added.) Other WMI-related cmdlets do work against these problem machines, so I don't think it's a auth or DCOM problem.</p>
  
  <p>Anyways, are there other ways of setting a timeout on a statement in a script that I can try?</p>