Screenshot script

Forums

Forums
Forums, discussions, and Q&A for all products.

Screenshot script

  • A while back, I think in the stolen laptop thread, there was a script to take a screenshot of the target machines desktop (see below). Anyways I was just playing with it and discovered that when it took a screenshot of my 64bit Win7 (running Aero) install it just came out black...



    As I recall this script worked on my Vista machine (32 bit also running Aero).



    Anyways I was wondering if anyone had seen the same thing in their testing, or if anyone knew the limitations of this app...







    Script Name: ScreenShot

    Script Description:



    IF Test File

    Parameter 1 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe

    Exists :

    THEN

    Execute Shell Command

    Parameter 1 : echo %random%>>#vAgentConfiguration.AgentTempDir#\datetime.txt

    Parameter 2 : 1

    OS Type : 13

    Get Variable

    Parameter 1 : 1

    Parameter 2 : #vAgentConfiguration.AgentTempDir#\datetime.txt

    Parameter 3 : datetime

    OS Type : 13

    Execute Shell Command

    Parameter 1 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe /f "#vAgentConfiguration.AgentTempDir#\desktop-#datetime#.jpg" /q 50

    Parameter 2 : 1

    OS Type : 13

    Get File

    Parameter 1 : #vAgentConfiguration.AgentTempDir#\desktop-#datetime#.jpg

    Parameter 2 : ..\Docs\#vAgentConfiguration.Machname#-desktop-#datetime#.jpg

    Parameter 3 : 1

    OS Type : 13

    Delete File

    Parameter 1 : #vAgentConfiguration.AgentTempDir#\datetime.txt

    OS Type : 13

    Delete File

    Parameter 1 : #vAgentConfiguration.AgentTempDir#\desktop-#datetime#.jpg

    OS Type : 13

    Delete File

    Parameter 1 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe

    OS Type : 13

    ELSE

    Get URL

    Parameter 1 : http://files.kaseya.com/sftp/CmdCaptureWin.exe

    Parameter 2 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe

    Parameter 3 : 3

    OS Type : 13

    Schedule Script

    Parameter 1 : 83199753

    Parameter 2 : 1

    Parameter 3 :

    OS Type : 13



    Legacy Forum Name: Screenshot script,
    Legacy Posted By Username: thirteentwenty
  • Try switching up the procedure to run the cmdcapturewin.exe process as user instead of system?

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Benjamin.Lavalley@kaseya.com
  • Benjamin.Lavalley@kaseya.com
    Try switching up the procedure to run the cmdcapturewin.exe process as user instead of system?


    Worked spledidly... sometimes it's the simplest things... thanks a milling Benjamin.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • Anyone know if there is a command option to have it take a screen shot of both monitors in a dual monitor environment? Currently only takes the primary monitor.

    Thanks.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: sbbssoft
  • I also would like to know how I can modify the script (or schedule a follow-up script) to delete the screenshots from the user's drive (temp folder) after they've been dumped to the KServer. Thanks.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: cameronpratto
  • cameronpratto
    I also would like to know how I can modify the script (or schedule a follow-up script) to delete the screenshots from the user's drive (temp folder) after they've been dumped to the KServer. Thanks.


    I almost reposted the script... But if you re-read it, that's exactly what this one does...

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • thirteentwenty
    I almost reposted the script... But if you re-read it, that's exactly what this one does...


    I even used to have it write the timestamp to the datetime variable but ran into issues with how the datetime was being created in the command line.

    One of my other stolen laptop scripts might leave files on the drive, I'd have to go look at them all to find out for sure.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Benjamin.Lavalley@kaseya.com
  • Benjamin.Lavalley@kaseya.com
    I even used to have it write the timestamp to the datetime variable but ran into issues with how the datetime was being created in the command line.

    One of my other stolen laptop scripts might leave files on the drive, I'd have to go look at them all to find out for sure.


    I've been thinking about doing that too, as far as putting the timestamp in the file name but am having issues with piping out the data also. I'll be sure to post if I figure it out... or when I figure it out... modifying/improving scripts are kind of on the back burner for a bit...

    I've edited the script just a bit to remove the check file from the if statement, mostly because I know it won't be there...


    Script Name: XP ScreenShot
    Script Description:

    IF True
    THEN
    Get URL
    Parameter 1 : http://files.kaseya.com/sftp/CmdCaptureWin.exe
    Parameter 2 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe
    Parameter 3 : 3
    OS Type : 13
    Execute Shell Command
    Parameter 1 : echo %random%>>#vAgentConfiguration.AgentTempDir#\datetime.txt
    Parameter 2 : 1
    OS Type : 13
    Get Variable
    Parameter 1 : 1
    Parameter 2 : #vAgentConfiguration.AgentTempDir#\datetime.txt
    Parameter 3 : datetime
    OS Type : 13
    Execute Shell Command
    Parameter 1 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe /f "#vAgentConfiguration.AgentTempDir#\desktop-#datetime#.jpg" /q 50
    Parameter 2 : 1
    OS Type : 13
    Get File
    Parameter 1 : #vAgentConfiguration.AgentTempDir#\desktop-#datetime#.jpg
    Parameter 2 : ..\Docs\#vAgentConfiguration.Machname#-desktop-#datetime#.jpg
    Parameter 3 : 1
    OS Type : 13
    Delete File
    Parameter 1 : #vAgentConfiguration.AgentTempDir#\datetime.txt
    OS Type : 13
    Delete File
    Parameter 1 : #vAgentConfiguration.AgentTempDir#\desktop-#datetime#.jpg
    OS Type : 13
    Delete File
    Parameter 1 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe
    OS Type : 13
    ELSE
    Get URL
    Parameter 1 : http://files.kaseya.com/sftp/CmdCaptureWin.exe
    Parameter 2 : #vAgentConfiguration.AgentTempDir#\cmdcapturewin.exe
    Parameter 3 : 3
    OS Type : 13
    Schedule Script
    Parameter 1 : 83199753
    Parameter 2 : 1
    Parameter 3 :
    OS Type : 13


    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • thirteentwenty
    I've been thinking about doing that too, as far as putting the timestamp in the file name but am having issues with piping out the data also. I'll be sure to post if I figure it out... or when I figure it out... modifying/improving scripts are kind of on the back burner for a bit...


    I do this all the time as we have created our own key under HKLM\Software and we store a lot of dates there for when various maintenance tasks were performed or corrective scripts were run. We can then check these dates in other scripts later.

    Here's the command I use:

    echo %date:~-4,4%%date:~-10,2%%date:~-7,2% >> #vAgentConfiguration.agentTempDir#\Date.txt


    That will give you a date in this format: 20100117

    For us, we then grab the contents of that file as a variable, set the proper registry value using that variable and then delete the temporary file. You could use a similar process to name your files.

    Michael

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: RCS-Michael
  • [QUOTE=RCS-Michael;51959]I do this all the time as we have created our own key under HKLM\Software and we store a lot of dates there for when various maintenance tasks were performed or corrective scripts were run. We can then check these dates in other scripts later.

    Here's the command I use:

    echo %date:~-4,4%%date:~-10,2%%date:~-7,2% >> #vAgentConfiguration.agentTempDir#\Date.txt


    That will give you a date in this format: 20100117

    For us, we then grab the contents of that file as a variable, set the proper registry value using that variable and then delete the temporary file. You could use a similar process to name your files.

    Michael[/QUOTE]

    It's worthwhile noting that anything that involves dates in DOS is going to be extremely dependent on where you are in the world and the date format set on the computer.

    You're much better off doing this in VBS.

    Andrew

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: andrew.doull@computer-care.com.au
  • Wouldn't most of us want the local machine's time? I know I would. Unless you have clients all over the world, which is a good problem Smile

    [QUOTE=andrew.doull@computer-care.com.au;51960]It's worthwhile noting that anything that involves dates in DOS is going to be extremely dependent on where you are in the world and the date format set on the computer.

    You're much better off doing this in VBS.

    Andrew[/QUOTE]

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: ReedMikel
  • ReedMikel
    Wouldn't most of us want the local machine's time? I know I would. Unless you have clients all over the world, which is a good problem Smile


    We do have people on the Kaseya forums all over the world... I'd like to think we take the time to help each other out.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: andrew.doull@computer-care.com.au
  • I must not be understanding your initial comment Andrew. My point was that since the vast majority of us only have clients that reside in the same time zone as us (the client's MSP), then there's really no concern about different date formats. Now, Kaseya on the other hand, does have clients all over the world - so date formats would be an issue for them...

    [QUOTE=andrew.doull@computer-care.com.au;52309]We do have people on the Kaseya forums all over the world... I'd like to think we take the time to help each other out.[/QUOTE]

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: ReedMikel
  • ReedMikel
    I must not be understanding your initial comment Andrew. My point was that since the vast majority of us only have clients that reside in the same time zone as us (the client's MSP), then there's really no concern about different date formats. Now, Kaseya on the other hand, does have clients all over the world - so date formats would be an issue for them...


    That is fine for 'most' of us. But not everyone: which is why I was pointing it out...

    e.g. The equivalent DOS command for British dates is:


    echo %date:~-4,4%%date:~-7,2%%date:~-10,2% >> #vAgentConfiguration.agentTempDir#\Date.txt


    and it is not uncommon to run into customers in Australia which have machines which are misconfigured with a mix of British and US date formats (I had to write a script to detect incorrect date formats for this scenario last month).

    Andrew

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: andrew.doull@computer-care.com.au
  • "My bad" - now I think I understand what you meant: that when writing scripts we need to consider that someone in other parts of the world might be using them and date formats need to be considered...

    [QUOTE=andrew.doull@computer-care.com.au;52453]That is fine for 'most' of us. But not everyone: which is why I was pointing it out...

    e.g. The equivalent DOS command for British dates is:


    echo %date:~-4,4%%date:~-7,2%%date:~-10,2% >> #vAgentConfiguration.agentTempDir#\Date.txt


    and it is not uncommon to run into customers in Australia which have machines which are misconfigured with a mix of British and US date formats (I had to write a script to detect incorrect date formats for this scenario last month).

    Andrew[/QUOTE]

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: ReedMikel