问题
I've got two Remote Desktops hosted by a Hyper-V.
On Remote Desktop "A", I've got a .bat file, which I want to execute.
On Remote Desktop "B", I've got a cmd open with psexec cmd ready to invoke .bat file on machine "A".
"path-to\\psexec.exe" \\ip -u domain\username -p pswd -i cmd.exe /c "path-to\\myFile.bat %*"
The script contained in .bat file on machine "A" operates on the UI and thus requires a real screen to be open, so I am connected to two RDs simultaneously. However, when I call psexec command on machine "B", the cmd returns an error, but if I open RD "A" directly through the server's Hyper-V manager's interface, the psexec command works as expected.
Can someone explain please why this happens?
回答1:
The UI of Windows runs on session 0. To run a program remotely that uses session 0, it will need to run as the System user (-s
flag), and you can specify the session to use (-i
flag). This answer has a few related tips too.
来源:https://stackoverflow.com/questions/38004985/sysinternals-psexec-not-running-on-the-remote-desktop