Script to do a Screen Capture and E-mail

Looking for some ideas or suggestions for a script to do a screen capture and some basic system info(OS, MEM, CPU, IP, Computer Name) and e-mail it off to a specified e-mail address.  Any thoughts or suggestions?  If system info is not doable, then the screen capture to e-mail is the major part.  One thing it needs to open to the message screen so they can explain there problem before it is sent.
webspeedwayAsked:
Who is Participating?
 
merowingerConnect With a Mentor Commented:
Ok Word and Outlook will be required to install on the client computer to make the below listed vbscript (.vbs) run
strScreenshot = "D:\Screenshot.doc"
strTo = "Helpdesk@YourCompany.com"

Set objWMIService = GetObject("winmgmts:\\" & "." & "\root\cimv2")

Set objWordBasic = CreateObject("Word.Basic")
objWordBasic.SendKeys "{prtsc}"
objWordBasic.AppClose "Microsoft Word"
Set objWordBasic = Nothing
'WScript.Sleep 2000

Set objWord = CreateObject("Word.Application") 
objWord.Visible = True 
objWord.Documents.Add 

Set objSelection = objWord.Selection

'Get computername
Set objNet = CreateObject("Wscript.Network")
objSelection.TypeText "Computername:" &objNet.ComputerName &vbNewLine

'Get OS version
Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objItem in colItems
	objSelection.TypeText "OS:" &objItem.Caption &vbNewLine
Next

'Get IP Address
Set colItems = objWMIService.ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each objItem In colItems
	If Not IsNull(objItem.IPAddress) Then
		For i=LBound(objItem.IPAddress) To UBound(objItem.IPAddress)
			objSelection.TypeText "IP:" &objItem.IPAddress(i) &vbNewLine
		Next
	End If
Next

'Get memory
Set colItems = objWMIService.ExecQuery ("Select * from Win32_ComputerSystem")

For Each objItem In colItems
	objSelection.TypeText "RAM:" &objItem.TotalPhysicalMemory /1024 /1024 /1000 &" MB" &vbNewLine
Next

'Get CPU
Set  colItems  =  objWMIService.ExecQuery("Select * from  Win32_Processor")
For  Each objItem In colItems
	objSelection.TypeText "CPU:" &objItem.Name
Next

'Paste Screenshot
objWord.Selection.Paste
objWord.ActiveDocument.SaveAs strScreenshot,6 
objWord.Quit
Set objWord = Nothing 

'Open Mail with attachment
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "Outlook.exe /m " &strTo &" /a " &chr(34) &strScreenshot &chr34 ,1,False

Open in new window

0
 
gimosubyConnect With a Mentor Commented:
Install AutoIT, and compile this:
---------------------------------------------------------------------
#include <ScreenCapture.au3>
_ScreenCapture_Capture("screenshot.jpg")
Run(@ComSpec & " /c " & 'systeminfo.exe > systemInfo.txt', "", @SW_HIDE)
---------------------------------------------------------------------

I suggest you use this in conjunction with the solution above. Then you'll have a smaller screenshot file and much more system information. (Open a command prompt and type 'systeminfo' to see what information you'll get.)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.