Author Posts

June 2, 2014 at 11:50 am

Hi all,
Would anyone know why I'm able to execute this command directly on my remote hyper-v vm:
Start-Process C:\Folder\SomeProgram.exe -ArgumentList /s -Wait

But this fails when I do this on the host machine:

$session = New-Pssession -ComputerName pc1 -Credential pass1
Invoke-Command -Session $session -ScriptBlock {Start-Process C:\Folder\SomeProgram.exe -ArgumentList /s -Wait}

Host PC OS: windows server 2012 datacenter
Remote PC OS: windows 7 (running PSv2)

Please let me know if you need any other information.

Thanks in advance!

June 2, 2014 at 3:08 pm

The -Credential parameter needs a credential object, not just a password.


$session = New-Pssession -ComputerName pc1 -Credential (Get-Credential)

Verify PowerShell remoting is enabled on the Windows 7 computer named pc1 (it's not enabled by default). Run Enable-PSRemoting on pc1.

June 2, 2014 at 3:16 pm

Thank you for the reply, but I've already double checked those two variables:
I was able to do this on my host, which verifies that i can communicate to my pc1.
Enter-PSSession -ComputerName pc1 -Credential

i miss-typed my credential from above. I manually enter in my password for now, until i can get a running version.

June 2, 2014 at 3:17 pm

I'm also using the admin account for both the host and the hyper-v vm...

June 2, 2014 at 3:27 pm

For simplicity, give this a try:

Create the $session as you previous were, then try this:


Invoke-Command -Session $session {Start-Process Notepad.exe}

Then check to make sure notepad is running:


Invoke-Command -Session $session {Get-Process Notepad}

June 2, 2014 at 3:34 pm

Yes, that gave me a result with the "ProcessName" of notepad

Now I'm really lost. Not sure where the disconnect.

June 2, 2014 at 3:38 pm

Can you run the same type of test for the process you're attempting to run?


Invoke-Command -Session $session -ScriptBlock {Start-Process C:\Folder\SomeProgram.exe -ArgumentList /s -Wait}


Invoke-Command -Session $session -ScriptBlock {Get-Process SomeProgram}

Note: SomeProgram should be running on the remote machine, but it will not be running interactively in the console.

June 2, 2014 at 3:46 pm

Yes, this returned a result:

Invoke-Command -Session $session -ScriptBlock {Get-Process SomeProgram}

i also see the process running in the IP Address I wanted it to be on. I went a step further and looked at the event log on the VM:

getting this error: "The description for Event ID 0 from source .NET Runtime cannont be found."

At least I'm moving forward, I did not get this error when I run the Start-Process directly on the VM... I will have to look up what that error is all about and how it's related to Powershell, if any.

June 2, 2014 at 3:51 pm

Is the same user account being used to start the process locally and remotely?

June 2, 2014 at 3:51 pm

Yes, the same user account (with admin rights) is being used.

June 2, 2014 at 4:13 pm

Just so I know I'm not going crazy, I went and reran the code below on my VM directly and it works the way it supposes to.
Start-Process C:\Folder\SomeProgram.exe -ArgumentList /s -Wait\

Not sure where the disconnect is when I use the invoke-command

Could this be a UAC issue? I'm trying doing a silent install of my .exe — from what i can tell of my run without the invoke-command the /s should have taken care of any UI and the admin right should take care of an UAC issues that i might encounter... Am I wrong?

June 3, 2014 at 1:45 am

You may be right about UAC. Only local administrator is never prompted for elevation by UAC, so even if the user account that you are using to start the application is an admin on the machine, by default the computer would still prompt for elevation.

When you run this code on the VM directly (as you said), does it prompt for elevation?

Start-Process C:\Folder\SomeProgram.exe -ArgumentList /s -Wait

If so, I'd say you have 3 options,
1) Look into how to change UAC settings so it automatically elevates without prompting.
2) Try starting the process with the local administrator credentials for the machine.
3) Examine your installer further. I know a lot of exe installers are just wrappers for an MSI, and if so you may be able to extract the contents of the installer, retrieve the MSI and install using MSIEXEC, which plays much nicer with UAC.

June 3, 2014 at 4:55 am

Hi Peter,
Thank you for your input. I was able to run Start-Process C:\Folder\SomeProgram.exe -ArgumentList /s -Wait directly without any prompts and everything installs just as I expected. My issue is with the Invoke-Command.

I will give option 3 a try: My installer has a SQL Express 2012 and an .msi in it... at this point I'm willing to try anything 🙂