What:
psexec, nircmd and Windows
Problem:
Take a screenshot of a remote computer in your network and save it to selected location. Optionally save 20 screenshots every minute in a loop.
Solution:
Download psexec from http://live.sysinternals.com/, download nircmd from http://www.nirsoft.net
psexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" -i -c nircmd.exe savescreenshot "c:\shot.png"shot.png will be saved on target computer
If you are logged on as administrator then you can skip -u and -p options, you can skip only -p then you will be prompt for a password.
psexec.exe \\192.168.1.10 -u "domain\administrator" -i -c nircmd.exe savescreenshot "c:\shot.png"Save 20 screenshots every minute in a loop:
psexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" -i -c nircmd.exe loop 20 60000 savescreenshot "scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png"
Gain access to remote pc via console (telnet equivalent):
psexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" cmd
I keep getting "nircmd.exe exited on (remote PC's IP) with error code 0."
ReplyDeleteI manually copied over nircmd.exe to %WinDir% of the remote PC, but then the command failed with "File already exists."
What could be the problem? Thanks!
Never mind, figured it out: error code 0 = success
ReplyDeleteImportant to note that c:\shot.png is saved to the hard drive of the remote PC, and the logged in user must have local admin rights to be able to write to C:
I am glad that you figured it out. Btw. domain\administrator has local admin rights, so there is no problem saving to the C: drive.
ReplyDeleteI'm getting a black screen, but when I run it locally on remote machine it works fine.
ReplyDeleteyou should use impressionate in the pstools parameters as the users differ and you are trying to get the screenshot of a non-interactive session thats why its blank
ReplyDelete@Tuwi D , or anyone....
ReplyDeleteI have the black screen screen capture issue. How do you use the impressionate feature of pstools? I tried using the flag -i but I still have the black screen issue.
Thanks in advance.
Got it working.... I had to user this:
Deletepsexec.exe -s -i \\192.168.0.120 nircmd.exe savescreenshot "C:\shot.png"
Btw, thanks OP of this article!!!!
Deletepsexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" -i -c nircmd.exe savescreenshot "c:\shot.png"
ReplyDeleteshot.png will be saved on target computer
If you are logged on as administrator then you can skip -u and -p options, you can skip only -p then you will be prompt for a password.
psexec.exe \\192.168.1.10 -u "domain\administrator" -i -c nircmd.exe savescreenshot "c:\tmp\shot.png"
Save 20 screenshots every minute in a loop:
psexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" -i -c nircmd.exe loop 20 60000 savescreenshot "scr~$currdate.MM_dd_yyyy$-~$currtime.HH_mm_ss$.png"
Gain access to remote pc via console (telnet equivalent):
psexec.exe \\192.168.1.10 -u "domain\administrator" -p "password" cmd
===============================================================================================================================================================================
Got it working.... I had to user this:
psexec.exe -s -i \\192.168.0.120 nircmd.exe savescreenshot "C:\shot.png"
The good :)
ReplyDelete