RA: Pass Workstation and Username Parameters to Offer Remote Assistance

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.

ORA is a bit of a programming pain because it requires client-side Javascript and it’s picky about what it will and will not let you do. I wanted to find a way to call ORA from a webpage and wondered how I would pass some variables to the script. The command line was not cooperating with me so I thought that perhaps I could hack together something with javascript and Microsoft.XMLHTTP but ORA denied me access. After some hackery, I discovered the joys of objSAFClassFactory.ExtraArgument.

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\.


<html XMLNS:helpcenter>
Copyright (c) 2000 Microsoft Corporation
<helpcenter:context id=idCtx />
<title>Remote Assistance</title>
<!-- The SAF class factory object -->
<object classid=CLSID:FC7D9E02-3F9E-11d3-93C0-00C04F72DAF7 height=0 id=objSAFClassFactory width=0></object>
<script LANGUAGE="Javascript">
function onContinue()
var g_szWorkstation = null;
var g_szUsername = null;
var c_WorkstationTag = "WORKSTATION=";
var c_UsernameTag = "&USERNAME=";

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();
objDict.add("DtStart", Math.round(Date.parse(d)/1000));
objDict.add("DtLength", "60");
objDict.add("Status", "Active");
objDict.add("URA", 1);
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 );
<body onload="onContinue();">

Once you saved the file in the proper location, you can call it by going to

%windir%\PCHEALTH\HELPCTR\Binaries\HelpCtr.exe -url hcp://system/cmdOfferRemoteAdmin.htm -ExtraArgument "WORKSTATION=winxpsp2&USERNAME=testlab\chrissy"

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.

Chrissy is a PowerShell MVP who has worked in IT for nearly 20 years, and currently serves as a Sr. Database Engineer in Belgium. Always an avid scripter, she attended the Monad session at Microsoft’s Professional Developers Conference in Los Angeles back in 2005 and has worked and played with PowerShell ever since. Chrissy is currently pursuing an MS in Systems Engineering at Regis University and helps maintain RealCajunRecipes.com in her spare time. She holds a number of certifications, including those relating to SQL Server, SuSE Linux, SharePoint and network security. She recently became co-lead of the SQL PASS PowerShell Virtual Chapter. You can follow her on Twitter at @cl.

Posted in Security
12 comments on “RA: Pass Workstation and Username Parameters to Offer Remote Assistance
  1. Zac says:

    The way to take away the Accept dialog is the following:

    In the c:\windows\pchealth\HelpCtr\System\Remote Assistance\helpeeaccept.htm you need to find these lines:

    btnAccept.disabled = false;
    btnDecline.disabled = false;

    to this

    btnAccept.disabled = false;
    btnDecline.disabled = false;

    I found this courtesy of the following forum:


    The thread also shows how to disable the Take Control prompt but I haven’t tried that yet.

  2. Zac says:

    OK, I followed the instructions on the thread and also was able to disable the Accept dialog for Take Control.

    Per the thread I had to do the following:

    change the file %WINDIR\pchealth\HelpCtr\System\Remote Assistance\Interaction\Server\TakeControlMsgs.htm

    find these lines:
    idExpert1.innerText = vArgs[0];
    idExpert2.innerText = vArgs[0];
    idExpert3.innerText = vArgs[0];

    Then add the following line below, but before the close bracket.
    // Added to allow take remote control of PC

    I tested this and it works in a non-domain environment on a LAN between 2 XP Pro 32 bit machines.

  3. MarkyMark says:

    ok…This looks like a handy tool but can the process be reversed? I want a short cut on each of my users desktops asking for remote assistance. This would then produce a pop up your email on my end. Is this possable? They all sit behind NAT on networks all over the contry so the tool above doesn’t really help me due to the NAT on there end.


  4. Steve says:

    Change the code in C:\WINDOWS\PCHEALTH\HELPCTR\Vendors\CN=Microsoft Corporation,L=Redmond,S=Washington,C=US\Remote Assistance\Escalation\Unsolicited\unsolicedrcui.htm to include a variable grabber and enter the variable as the default value in the idComputerName box… Seems logical anyway…

  5. Dave says:

    I’m sorry, I’m not good with HTML, can you give me some idea where I can get started in that file?

  6. edward says:

    i edited the htm files and be able to remote to client computer without user clicking OK, but if client have a computer locked then you can’t do anything with it. is there anyway we can hit the control +alt +delete to log in? thanks

  7. chris says:

    this looks very promising but i’d like to simplify it a bit. i dont quite need the automation of passing the username (although that worked successfully). can i chop out the code requiring the username and just pass the computername? The goal is to open help center with the computer field populated, and let the choosing of the user session be a manual process from there forward.

    thanks for any assistance, nice effort too, not much posted on how to do this.


  8. Ron says:

    That is a very nice example of how to interact with Remote Assistance. I incorporated something similiar in a program I wrote. Passing the machine name using oSAFClassFactory.ExtraArgument to a slightly modified version of unsolicited.htm allows it to still poll the remote machine for active users. If anyone is interested Remote Assistance Helper can be dowloaded at http://www.digitaltaproom.com. It’s free by the way.

  9. Kevin says:

    This is exactly what I’ve been looking for!!! But I’m getting the dreaded Blank Help page… is there any way to trace the code to figure out where it is going wrong?

    I am able to “Offer remote assistance” when I type the fields in manually, but I want that piece to be automated via the parameter passing… If I could get this to work I’d be a happy guy!

  10. Barlug says:

    have somebody found the way to reverse the process? I mean to pass values to “ask for remote assistance” ?

  11. Larry says:

    Very nice bit of scripting. However, if you are having trouble (getting the blank help page) it is because there are errors in the above script. First, the line about 3/4 of the way down that begins “var szRAURL =” does not have the backslashes escaped. Change all the “\” in the path to “\\”. Also, there is something amiss in the parsing of the domain\username from the ExtraArgument. I didn’t bother debugging that since there are other ways to pass variables to a script. Try hardcoding your workstation, username, and domain on the line that begins “objInc.RcTicket =”. If that works, you should be good. You’ll just have to decide how you want to get those values passed in. Either fix the parsing above or skip the ExtraArgument stuff (in the script and in the calling URL) if you have a different approach.

    However, this is a very helpful piece of script. It saved me a lot of time when I almost gave up on deconstructing the script in UnSolicitedRCUI.htm.

    Thanks Chrissy!

  12. Don’t anthropomorphize computers – they hate it :))

1 Pings/Trackbacks for "RA: Pass Workstation and Username Parameters to Offer Remote Assistance"
  1. […] de tekst door een script worden ingetypt. Ook heeft iemand het mogelijk gemaakt om met een extra script wel de hostname mee te geven. Tenslotte kan het door Remote Assistance gebruikte bestand […]

Leave a Reply

Your email address will not be published. Required fields are marked *