Using VBScript, I was able to automate the Microsoft Remote Assistance. The script leverages Gmail, MSRA.exe, a capture tool, and nircmd. By doing so, Remote Assistance is launched, the incident is captured, the RA code is captured, an email is started, and the RA code is pasted from clipboard.
' RUN LOCALLY ON COMPUTER ' REMOTE ASSISTANCE MUST BE ENABLED IN GP ON ERROR RESUME NEXT Dim objShell, objFSO, strTemp, strRAIncident, strURL, strEmail, strSubject, strBody, strComputer, browserApp, actionCommand, charCheck, strSerial Set objShell = CreateObject("WScript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") 'EMAIL - WHO RECEIVES THE INCIDENT strEmail = "ONE@emailaddress.com" 'strEmail = "ONE@emailaddress.com;TWO@emailaddress.com" 'SUBJECT serial() strUser = CreateObject("WScript.Network").UserName strComputer = objShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" ) strSubject = "[Remote" & "+" & "Control]" & "+" & strUser & "+" & strComputer & "+" & strSerial 'URL strURL = "https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to="&strEmail&"&su="&strSubject&"&body=" & chr(34) 'BROWSER TO USE browserApp = "Chrome" ' S E Q U E N C I N G '1 - IS CHROME RUNNING CheckProcess() '2 - CREATE INCIDENT FILE USING MSRA.EXE - VERIFIES DATA GenerateIncident() 'Paste Password objShell.AppActivate "Windows Remote Assistance" WScript.Sleep 500 objShell.AppActivate "Windows Remote Assistance" 'capture image of remote assistance window objShell.Run "C:\RemoteAssistance\cap.exe /quality=100 /active /file=" & "remote.jpg",9,true objShell.AppActivate "Windows Remote Assistance" 'add capture to clipboard objShell.Run "C:\RemoteAssistance\nircmd.exe clipboard copyimage remote.jpg",0,true WScript.Sleep 500 '3 - CREATE ACTION COMMAND actionCommand = "Chrome" & " " & strURL & strRAIncident '4 - RUN ACTION COMMAND objShell.AppActivate "Chrome" 'launch Chrome, GMail objShell.Run actionCommand,9,false 'ADD SNAPSHOT 'wait X amount of time WScript.Sleep 8000 objShell.AppActivate "Chrome" objShell.SendKeys "MICROSOFT REMOTE ASSISTANCE" WScript.Sleep 500 objShell.SendKeys "+{ENTER}" objShell.SendKeys "+{ENTER}" objShell.SendKeys "________________" 'objShell.SendKeys "^v" objShell.Run "C:\RemoteAssistance\nircmd.exe sendkeypress Ctrl+V",9,true objShell.SendKeys "________________" objShell.SendKeys "+{ENTER}" objShell.SendKeys "+{ENTER}" objShell.SendKeys "~" 'If you want to send email automatically 'objShell.SendKeys "^{ENTER}" 'WScript.Sleep 2000 'objShell.SendKeys "^{ENTER}" 'SHIFT use + 'CTRL use ^ 'ALT use % 'SESSION CLEANUP objShell.Run "%comspec% /c del /q C:\RemoteAssistance\remote.msrcincident",0,true objShell.Run "%comspec% /c del /q C:\RemoteAssistance\remote.jpg",0,true objShell = "" objFSO = "" strTemp = "" strRAIncident = "" strURL = "" strEmail = "" strSubject = "" strBody = "" strComputer = "" browserApp = "" actionCommand = "" charCheck = "" strSerial = "" WScript.Quit 'SUBS HERE sub GenerateIncident() 'launch loading... objShell.run "c:\RemoteAssistance\loading.exe c:\RemoteAssistance\loading.hta",9,false 'clear previous session objShell.Run "taskkill /f /im msra.exe",0,true objShell.Run "%comspec% /c del /q remote.msrcincident",0,true strTemp = "" WScript.Sleep 2000 'kill splash objShell.Run "taskkill /f /im loading.exe",0,false 'start new session objShell.Run "%comspec% /c msra.exe /saveasfile remote",0,false 'wait for incident to be created If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000 If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000 If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000 If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then WScript.Sleep 2000 'makes sure incident exists If NOT (objFSO.FileExists("C:\RemoteAssistance\remote.msrcincident")) Then msgbox "Missing Microsoft Incident File. Check the remote assistance settings on the computer and try again.",48,"Alert" WScript.Quit() end if strTemp = objFSO.OpenTextFile("remote.msrcincident").ReadAll() 'some minor checks of the incident file itself 'if ampersand exists, recreate incident 'URL encoding uses ampersands to separate content If inStr(strTemp, "&") Then call GenerateIncident() 'replace double quotes 'corrected for URL encoding strRAIncident = Replace(strTemp, """", "%22") 'replace hashtag 'corrected for URL encoding strRAIncident = Replace(strRAIncident, "#", "%23") 'check to see if space exists in password stub 'the incident has issues with spaces when emailing, so recreate incident charCheck = Right(strRAIncident,111) charCheck = "X" & left(charCheck,1) & "X" If charCheck = "X X" then call GenerateIncident() end sub sub CheckProcess() 'check to see if Chrome is open Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = " & "'"&browserApp&".exe'") If colProcesses.Count = 0 Then msgbox "Please log into Gmail and launch again!",48,"Alert" WScript.Quit End If 'check to see if Remoate Assistance is closed Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colProcesses = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = " & "'msra.exe'") If colProcesses.Count <> 0 Then msgbox "Please close existing Remote Assistance session and launch again!",48,"Alert" WScript.Quit End If end sub sub Serial() 'returns serial on error resume next strComputer = "." Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS") For Each objItem in colItems strSerial = objItem.SerialNumber next end sub