For those of you who successfully use the shortcut for Offer Remote Assistance (ORA), you’ve probably wanted to automate it just a little more with parameters at some point or another. You may have even come across EdmSaleBoy’s Usenet Post titled “Programatically Offer Remote Assistance.” I did a few times but it didn’t do exactly what I wanted to. Though I appreciated EdmSaleBoy’s code extraction skills, I didn’t find the solution of overwriting UnsolicitedCUI.htm to be very elegant so I spent some hours looking into alternatives.
Using objSAFClassFactory.ExtraArgument, I was able to dynamically pass the workstation name and username (note: the username MUST be in the domain\username format or it won’t work.) So now I present to you the following code, which you can save as cmdOfferRemoteAdmin.htm under the directory %windir%\pchealth\helpctr\System\.
var szArgs = objSAFClassFactory.ExtraArgument;
var i = szArgs.indexOf(c_WorkstationTag); var j = szArgs.indexOf(c_UsernameTag); g_szWorkstation = szArgs.slice(i+c_WorkstationTag.length, j); g_szUsername = szArgs.slice(j+c_UsernameTag.length);
var i = g_szUsername.indexOf(""); g_szDomainName = g_szUsername.slice(0, i); g_szUserName = g_szUsername.slice(i+1); g_szSessionId = -1;
g_oSAFRemoteDesktopConnection = objSAFClassFactory.CreateObject_RemoteDesktopConnection(); g_oSAFRemoteConnectionData = g_oSAFRemoteDesktopConnection.ConnectRemoteDesktop(g_szWorkstation);
objInc = objSAFClassFactory.CreateObject_Incident();
objInc.RCTicketEncrypted = false;
objInc.RcTicket = g_oSAFRemoteConnectionData.ConnectionParms( g_szWorkstation, g_szUserName, g_szDomainName, -1, "");
var objDict = objInc.Misc;
var d = new Date();
objFSO = new ActiveXObject("Scripting.FileSystemObject");
tempDir = objFSO.GetSpecialFolder( 2 );
szIncidentFile = tempDir + "\UnsolicitedRA" + objFSO.GetTempName();
var oShell = new ActiveXObject("WScript.Shell");
var szRAURL = 'C:\WINDOWS\pchealth\helpctr\binaries\helpctr.exe -Mode "hcp://system/Remote Assistance/raura.xml" -url "hcp://system/Remote Assistance/Interaction/Client/RcToolscreen1.htm"' + ' -ExtraArgument "IncidentFile=' + szIncidentFile + '"';
oShell.Run( szRAURL, 1, true );
objFSO.DeleteFile( szIncidentFile );
Once you saved the file in the proper location, you can call it by going to
The downside to this code is that there’s little to no error handling. If just a blank “Windows Help” page appears, you’ve done something wrong. Make sure the computer you are attempting to connect to is pingable and that the username is in the correct format (domain\user). Also, make sure you can get the regular Offer Remote Assistance to work before calling this more advanced technique. If you are having trouble with ORA, this posting may provide some help.