Quick question, have searched for awhile but can't find answer anywhere.
Some background:
I have a local machine and remote machine (Virtual Machine) that I am connecting through RDP.
I have a batch file that I run that starts the RDP session through powershell commands and logs in with credentials.
My next step is where I run into problems, I have another batch file on the remote machine that I want to run (also Powershell commands).
When I run this batch file physically through the RDP (by either double clicking or running through command prompt) all is well.
When I trigger the batch file remotely the batch file runs, but not the way I want. It seems like it runs in the background and not actually showing what its doing through the RDP session I have. The reason I don't want this running in silent mode is because I have a script that uninstalls and re installs a program. Since it is not MSI I have to have several "Send Keys" in my code.
So in the end my question is this, can I run a batch file remotely that will act as if I double clicked the batch file on the remote machine??? I believe that there is an option psexec, but I would prefer not to use any more programs than needed.
Best Answer
Have you tried Enter-PSSession?
or