Jump to content

Recommended Posts

Posted

I wanted to capture the screen via a script or command line if at all possible? Looks like its not (security issue?).

 

I could try the VNC method instead, can you send me a link?

 

Cheers!

Posted

There's a commandline utility called lsgrab which will do it if that's what you're after.

 

I have a batch file in my quicklaunch I can click on which will prompt me to enter a computer name and it then grabs the screenshot to a jpg and shows it me. Here's the script portion, which also needs the sleep utility from the resource kit to work properly. I've put my admin username into my shortcut to it to save some typing.

 

@echo off
REM Grab a screenshot from a remote PC
REM screengrab [adminusername] [hostname]

IF "%1" == "" (
 SET /P varAdminUser=Enter your admin username, e.g. sahmeepee:  
) ELSE (
 SET varAdminUser=%1
)

IF "%2" == "" (
 SET /P varHost=Enter the hostname, e.g. computer69:  
) ELSE (
 SET varHost=%2
)


REM make a local directory to store the images
if not exist c:\screenshots\nul mkdir c:\screenshots

REM if we already have an image from this PC, delete it
if exist c:\screenshots\%varHost%.jpg del c:\screenshots\%varHost%.jpg

REM grab the image, cd variable is current directory
runas /user:canon-slade\%varAdminUser% /noprofile "\\admin-file\public\ict team\Scripts\GrabRemoteScreen\lsgrab.exe /c:%varHost% /p:c:\screenshots\"


REM nasty goto loop to wait for image to be created
:tryImage
REM has the image been created?
if exist c:\screenshots\%varHost%.jpg (
 REM display the image with windows preview
 start rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen c:\screenshots\%varHost%.jpg
 goto exitScript
) ELSE (
 REM give the command a little longer to run and try again
 sleep -m 250
 goto tryImage
)

:exitScript

  • Thanks 1
Guest monkeyx
Posted (edited)

I have gotten this to work via c# running a remote executable. It uses some WMI to help connect to get machine info etc. But as far I know WMI can not do the screen shot itself. I am using this to create a thumbnail viewer that will show screen shot of a range of machines every couple of minutes.

 

I have also used lsgrab before and that is a great utility. psexec can also be used to run progams that can generate screen shots locally etc. then pipe the results back via a script.

Edited by monkeyx

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...