title: Installing an .exe on a remote machine from PowerShell
body: <p>So, I have been trying to do the following via a PowerShell script:</p>
  
  <p>For a list of computers, do:</p>
  
  <ul>
  <li>Ping the computer (via WMI) to see if it's available; if not, log &amp; break, if so, continue on</li>
  <li>Create a folder on the root of the C:\ drive (via Invoke-WmiMethod); if fails, log &amp; break, if successful, continue on</li>
  <li>Copy files (includes an .exe) from another machine into that folder; if fails, log &amp; break, if successful, continue on</li>
  <li>Run the .exe file (via Invoke-WmiMethod); if fails, log &amp; break, if successful, log success, done (with this computer.)</li>
  </ul>
  
  <p>The problem I'm running into is the execution of the .exe (program installer) -- the Invoke-WmiMethod command usually works, but for some machines, it hangs (not fails, but hangs.) I've tried a whole bunch of stuff to try to get it to run as a job so I can set a timeout on the install (running the <code>Invoke-WmiMethod</code> command with <code>-AsJob</code> param, always returns <code>Failed</code>...; <code>Start-Job -Computer $compname { Invoke-WmiMethod...</code>, returns <code>Completed</code> but the install never happens; making sure the remote machines have Windows Firewall disabled, UAC turned off, etc. but still if I run the <code>Invoke-WmiMethod</code> command on them, not running as a job, it hangs. And yes, I'm running PS as a Domain Admin, so I should have rights on the target machines.)</p>
  
  <p>So being a newb at all things PowerShell, I'm now at a complete loss as to what to try next... How would <em>you</em> tackle running a .exe on a remote system from a PowerShell script? One caveat is that the target machines don't all run PowerShell [V1|V2] (target PCs are a mix of XP, Vista and 7) or don't have remoting enabled. The other caveat being that the installer is an .exe, and not an .msi, and this can't be changed (it's a third-party app.)</p>
  
  <p>Thanks in advance to anyone who can point me in the right direction here (and give me some sample code...)</p>