title: Starting a .exe file on a remote computer using powershell
body: <p>Hey everyone I'm attempting to start a exe file on remote systems, we have an agent that runs to connect our website to our database and printers. It hangs occasionally, and requires us to remote in and/or go to the station and restart the application. I've attempted many different solutions on here and none seem to work. </p>
  
  <p>I'm able to kill the process that is running but then it will not reopen the exe file to start it again. Here is the small script so far</p>
  
  <pre><code>################################################
  write-host "This will Restart Workbench helper please press the any key to  start"
  pause
  $mycreds = Get-Credential
  $computer = Read-Host -prompt "Please Enter Computer Name"
  $WBSTART1 = Read-Host -prompt "please enter command"
  $pers = New-PSSession -ComputerName $computer -Credential $mycreds
  # Gets Computer Name and Kills Workbench Helper #
  
  (Get-WmiObject win32_process -ComputerName $computer -Credential $mycreds |  ?{ $_.ProcessName -match "Workbench3.helper" }).Terminate()
  
  # Writes Host countdown to screen # 
  write-host -ForegroundColor black -NoNewline "Stopping Process"
  foreach ($element in 1..10)
  {
  Write-Host -NoNewline "${element} " -BackgroundColor 'white' - ForegroundColor 'black'
  Start-Sleep -Seconds 1
  }
  Write-Host ''
  Write-host "Process Complete"
  Start-Process -filepath "C:\Program Files (x86)\Company Security\Workbench3 Helper\WorkBench3.Helper.exe"
  
  # Writes Host countdown to termination Screen # 
  write-host -ForegroundColor black -NoNewline "Starting Workbench Process"
  foreach ($element in 1..10)
  {
  Write-Host -NoNewline "${element} " -BackgroundColor 'white' -ForegroundColor 'black'
  Start-Sleep -Seconds 1
  }
  Write-Host ''
  Write-host "Process Complete"
  
  
  # Starts Process #
  $WBSTART = {start-process -filepath 'C:\Program Files (x86)\FrontPoint  Security\Workbench3 Helper\WorkBench3.Helper.exe'}
  Invoke-Command –ComputerName $computer -Credential $mycreds -ScriptBlock $WBSTART 
  </code></pre>
  
  <p>#Starts Process# at the end runs with no errors, but nothing happens on the remote machine, killing the process works fine. Any help would be greatly appreciated.</p>