Session ID in PSExec

孤者浪人 提交于 2019-12-11 13:11:09

问题


Psexec fails to display a notepad GUI on the remote session for me. So, I am trying to get the session id as below:

c:\Users\Amitra\Downloads\PSTools>PsExec -u administrator -p force \\135.20.230.160 query session
PsExec v2.11 - Execute processes remotely
Copyright (C) 2001-2014 Mark Russinovich
Sysinternals - www.sysinternals.com
 SESSIONNAME       USERNAME                 ID  STATE   TYPE        DEVICE
>services                                    0  Disc
 rdp-tcp#0         Administrator             1  Active  rdpwd
 console                                     4  Conn
 rdp-tcp                                 65536  Listen
query exited on 135.20.230.160 with error code 1.

Now, with the above output, what should be the correct command in psexec to run notepad on the IP address?


回答1:


If you are just trying to run notepad on the remote machine do the following:

psexec \\135.20.230.160 -u administrator -p force C:\notepad.exe

More info on psexec

Also I am assuming your password is "force" and as a side note you should not put your password online...

If you want to see notepad.exe open on the machine you are connecting to, for example if you are remote connected into that machine while using psexec from another you would use the following

psexec \\135.20.230.160 -u administrator -p force -i 1 C:\notepad.exe

The 1 after the -i is the session number which needs to correspond to the session which you are logged in as.

To find out what session you are currently logged in as open any program and in console type TaskList and find your program and look at the session number.



来源:https://stackoverflow.com/questions/28279044/session-id-in-psexec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!