title: How to run processes with Invoke-WMIMethod on remote computer in foreground
body: <p>I am running this command</p>
  
  <pre><code>Invoke-WmiMethod -ComputerName $machine -Credential $cred -Impersonation 3 -Path Win32_process -Name create -ArgumentList "powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows_Updates.ps1" -Verbose
  </code></pre>
  
  <p>The only problem is in the remote machine, it getting created as a background process. When I open the task manager, I am able to see powershell.exe, but I have no way to identify what is going on. I have looked nearly everywhere but unable to find a solution. </p>
  
  <p>Basically I need to execute the powershell file remotely. I am open to using other solutions where I can see the script running.</p>