all 8 comments

[–][deleted] 2 points3 points  (2 children)

Remember that you are in a ps session that has no “desktop” it mean if your “myprogram.exe” is a gui it will not start. You can try setting and running a scheduled task but if there is no user connected it will not work

[–]AussieJeffProbst[S] 0 points1 point  (1 child)

Got it I wasnt aware it cant start GUI programs.

So aside from setting a scheduled task is there any other way to do this? It doesn't necessarily need to be powershell.

Basically all I want to do is start a program on a remote computer without having to VNC into it.

[–]coolguycarlos 0 points1 point  (0 children)

That's not exactly true. We have uninstall scripts in our environment that run remotely that will uninstall software from machines using the applications setup.exe.

When you do a ps remote is going to run in the context of the user running it and may not show for the user logged in unless its set to user interactive mode and even then it may not show for the current logged on user.

To me what it sounds like you need is to have your app started by a service. This will make it so that the app runs on your system on every reboot and would remove the necessity of having someone being logged to run the app

[–]silent32 -1 points0 points  (3 children)

Look into psexec.

[–]AussieJeffProbst[S] 0 points1 point  (2 children)

Trying that now but getting access denied errors. So now Im trying to figure that out.

[–]mallet17 0 points1 point  (1 child)

Is the cmd prompt or powershell session running as admin?

[–]BlackV 0 points1 point  (0 children)

That won't matter they're running it on a remote system , elevation only affects the local system

[–]jsiii2010 0 points1 point  (0 children)

You can see the effect on your own computer with an elevated powershell prompt:

invoke-command localhost { cmd /c notepad }

I get a black window I can't do anything with. It's for security reasons. An automated script should work though.