Starting a Program with Powershell Remoting

0

Using Windows Powershell, this opens notepad.

notepad.exe

But this, which is meant to remote into a virtual machine and open notepad there, does not. Instead, the process starts but the GUI is hidden.

$s = New-PSSession -ComputerName MyVirtualMachine
Invoke-Command -Session $s -ScriptBlock {notepad.exe}

I need to know a few things.

  1. How do I start a process with Powershell remoting such that its GUI is visible?
  2. Why is the GUI invisible?
  3. If I follow your advice regarding item 1., what are the implications regarding how the process starts? I want the process to start as the user I am logged in as (same as credentials I am connecting Powershell with).
  4. I want to choose whether the process has administrator privileges (the credentials will) as I need to run tests on processes both with and without admin rights.
  5. Other factors you can think of which may affect how the process runs. I am testing software, so the behavior ought to be identical to a user double clicking on an icon.

Void Star

Posted 2015-08-05T15:26:46.250

Reputation: 355

This appears to be a duplicate, but not on superuser. Here are related questions on other SE sites. http://stackoverflow.com/questions/3570517/running-remote-gui-app-in-powershell http://serverfault.com/questions/690852/use-powershell-to-start-a-gui-program-on-a-remote-machine

– Void Star – 2015-08-05T18:28:12.707

How should I close this question? – Void Star – 2015-08-05T18:28:32.780

No answers