Community
psexec from terminal
john kumpf,
User (Posts: 85)
Dec 19, 2016 4:54:13 pm EST
Support level: Free or trial
v6.3.0.6 on host and viewer.
windows 7 on both (all three).
I am trying to log into HOST_1 in the Viewer, and start Remote Utilities 'terminal'. From that command prompt, use 'psexec' to start cmd.exe on the HOST_2. Then execute cmd.exe command line commands on HOST_2. In my case, HOST_1 and HOST_2 are on the same LAN. I am remote to that LAN.
(psexec is part of the popular sysinternals utilities from Microsoft. I'm using v2.11.)
One more note, same user login on both computers on remote LAN. Also of note, this user has no password, which can make a difference.
But first, I know it should work, because if I use Remote Utilities to connect to the desktop of HOST_1 and use regular cmd.exe started from the remote desktop on HOST_1 and run psexec in there, it works fine. Here's a log:
But, when I use Remote Utilities 'Terminal' to connect to the same HOST_1 and do the exact same thing, it doesnt work. It appears to connect, then exit immediately with "code 0" which I believe means no error. In other words, it doesnt attach the input stream (my keyboard typing) to the HOST_2 cmd.exe so I can type commands.
Note: I am doing File -> Current User because doing it as the 'system' account has other problems. You can see the change in the log:
windows 7 on both (all three).
I am trying to log into HOST_1 in the Viewer, and start Remote Utilities 'terminal'. From that command prompt, use 'psexec' to start cmd.exe on the HOST_2. Then execute cmd.exe command line commands on HOST_2. In my case, HOST_1 and HOST_2 are on the same LAN. I am remote to that LAN.
(psexec is part of the popular sysinternals utilities from Microsoft. I'm using v2.11.)
One more note, same user login on both computers on remote LAN. Also of note, this user has no password, which can make a difference.
But first, I know it should work, because if I use Remote Utilities to connect to the desktop of HOST_1 and use regular cmd.exe started from the remote desktop on HOST_1 and run psexec in there, it works fine. Here's a log:
Microsoft Windows [Version 6.1.7601]Success!
Copyright © 2009 Microsoft Corporation. All rights reserved.
C:\windows\system32>cd \path_to\sysinternals\PSTools
C:\path_to\sysinternals\PSTools>echo %computername%
HOST_1
C:\path_to\sysinternals\PSTools>whoami
HOST_1\generic_user
C:\path_to\sysinternals\PSTools>psexec \\HOST_2 -accepteula -h cmd
PsExec v2.11 - Execute processes remotely
Copyright © 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.
C:\Windows\system32>echo %computername%
HOST_2
C:\Windows\system32>whoami
HOST_2\generic_user
C:\Windows\system32>
But, when I use Remote Utilities 'Terminal' to connect to the same HOST_1 and do the exact same thing, it doesnt work. It appears to connect, then exit immediately with "code 0" which I believe means no error. In other words, it doesnt attach the input stream (my keyboard typing) to the HOST_2 cmd.exe so I can type commands.
Note: I am doing File -> Current User because doing it as the 'system' account has other problems. You can see the change in the log:
Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.
C:\windows\system32>whoami
nt authority\system
C:\windows\system32>Microsoft Windows [Version 6.1.7601]
Copyright © 2009 Microsoft Corporation. All rights reserved.
C:\windows\system32>whoami
HOST_1\generic_user
C:\windows\system32>echo %computername%
HOST_1
C:\windows\system32>cd \path_to\sysinternals\PSTools
C:\path_to\sysinternals\PSTools>psexec \\HOST_2 -accepteula -h cmd
PsExec v2.11 - Execute processes remotely
Copyright © 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
Microsoft Windows [Version 6.1.7601]Connecting to HOST_2...
Starting PSEXESVC service on HOST_2...
Connecting with PsExec service on HOST_2...
Starting cmd on HOST_2...
cmd exited on HOST_2 with error code 0.
C:\path_to\sysinternals\PSTools>echo %computername%
HOST_1
C:\path_to\sysinternals\PSTools>whoami
HOST_1\generic_user
C:\path_to\sysinternals\PSTools>
Conrad,
Support (Posts: 3074)
Dec 20, 2016 10:50:03 am EST
Hello John ,
I asked our development about this. Unfortunately, due to some technical reasons in the Terminal mode we cannot exactly replicate how windows cmd works.
I asked our development about this. Unfortunately, due to some technical reasons in the Terminal mode we cannot exactly replicate how windows cmd works.
* Website time zone: America/New_York (UTC -5)