V
V
VITYA-XY12021-08-19 17:59:09
PowerShell
VITYA-XY1, 2021-08-19 17:59:09

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

3 answer(s)
V
Vladimir, 2021-08-19
@FluffyBeaver

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?

M
Morrowind, 2021-08-21
@hekkaaa

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.

M
MaxKozlov, 2021-08-19
@MaxKozlov

Or maybe just what you need to prescribe in the autostart for the user?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question