local OS: Windows Server 2003
remote OS: Windows Server 2003 64-bit
I have a management server (32-bit) which has many scheduled batch scripts running on. One of the script is to use psexec
to launch
process on remote host(64-bit).
My script just simply does below. However it will return "The handle is invalid"
.
C:\psexec.exe \\%HOST% -i 1 -d -u %ADMINID% -p %ADMINPASSWORD% -w %PATH% MyApplication.exe
Look up online found that RDP to session 1 and psexec to session 1 may have different environment and different available system resources (handles). So that's probably why my psexec script doesn't work.
However, make psexec running under console session in the script does work.
C:\psexec.exe \\%HOST% -i 0 -d -u %ADMINID% -p %ADMINPASSWORD% -w %PATH% MyApplication.exe
There are some people say run psexec under WoW64 or let psexec launch the application under WoW64 can be a work-around on 64-bit machines. I am guessing psexec on console session does similar. Can anyone confirm?
My question: my application has GUI, so I still need it running in user session. Is there any way to do this? Please advise, thanks.
Best Answer
You can achieve running in interactive mode using below command:
Above works, if you don't want to capture exit code from the application launched.