Answer the question
In order to leave comments, you need to log in
How to run mstsc.exe INTERACTIVELY on a remote server using powershell?
Tried like this:
mstsc.exe /h:850 /w:1000 "C:\TEST.RDP"
and like this:
Invoke-Expression "mstsc.exe /h:850 /w:1000 C:\TEST.RDP"
Locally on the server 2 commands work out, remotely the script does not knock out any errors in any of the other cases.
Answer the question
In order to leave comments, you need to log in
If the task is reduced to the wording "run something on a remote machine in the context of a user working there", I would create a task there in the Task Scheduler (on behalf of that user), which would run a certain script. Then, if necessary, run something - we edit the script and run the task, and the task already runs the script in the user context.
Maybe there is a more "correct" way.
But why is it at all?
Your task is easier to solve through taskscheduler. In the launch properties, you can also try to specify / h: 850 / w: 1000
Here the question is not about Powershell, but about OS Windows you have.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question