Allowing Remote Assistance to accept the machine name as a parameter

In a previous post I talked about how the Program Builder functionality of Service Desk Express allowed me to launch the Microsoft Remote Assistance tool. Whilst this was neat, what I really needed was to be able to prefill the machine name on the remote assistance page with a machine name as shown below:

Remote Assistance Screen

Remote Assistance Screen

The first thing we needed to do was to hack the Remote Assistance tool to accept a parameter. To do this you need to open

C:WINDOWSpchealthhelpctrVendorsCN=Microsoft Corporation,L=Redmond,S=Washington,C=USRemote AssistanceEscalationUnsolicitedUnSolicitedRCUI.htm

using, for example Notepad. Near the top of the file there is a function called OnLoad that looks like:

function onLoad()
{
;
;
try
{
setTimeout("idComputerName.focus()",250);
g_oSAFRemoteDesktopConnection = oSAFClassFactory.CreateObject_RemoteDesktopConnection();
}
catch(error)
{
FatalError( L_RCCTL_Text, error );
}
;
return;
}

All we need to do is add a couple of lines of Javascript at the top of this function that basically says, if the QueryString of the passed URL (the bit after the ? in a URL e.g. p=51 in the case of http://www.joatit.com/wordpress/?p=51 ) is not equal to the word “machinename”, prefill the machine name in the idComputerName textbox. So after editing, the function should look like:

function onLoad()
{
;
;
try
{
if (window.location.search.substring(1)!= "machinename")
{
idComputerName.value = window.location.search.substring(1);
}
setTimeout("idComputerName.focus()",250);
g_oSAFRemoteDesktopConnection = oSAFClassFactory.CreateObject_RemoteDesktopConnection();
}
catch(error)
{
FatalError( L_RCCTL_Text, error );
}
;
return;
}

Ok, so save that and now we are ready to launch it from Service Desk Express. So as per the previous post, log onto the Service Desk Express application server and run builder.exe that lives in C:Program FilesBMCService Desk ExpressTools. You should be greeted with a screen that looks like the example below:

Program Launcher

Program Launcher

In the Filename textbox enter: RemoteAssistance.asp

In the Command line textbox enter:

C:WINDOWSPCHEALTHHELPCTRBinariesHelpCtr.exe -url hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/ Remote%20Assistance/Escalation/Unsolicited/ UnsolicitedRCui.htm?machinename"

and click Build Launch File.

Now using Form Customisation you can add a Customised Toolbar Button of type link to, for example, the Machine Name field in the Inventory Item module, by specifying a URL of:

http://<SDEServerName>/SDE/RemoteAssistance.asp?machinename=$64$

So, the obvious question is, where does the $64$ come from? The answer lies by running the following SQL statement:

SELECT * FROM SMSYSDBINFO WHERE View_Name = 'Inventory Items'

If you find the Machine Name field in the ALIAS column and look across to the INTERNAL_COL_ID for that field, you will find 64.

The final “icing on the cake” comes by using the DB Admin Tool to expose that Machine Name field to the Incident module by adding a new virtual field (let’s say called ‘Asset Machine Name’) through the existing Seq.Inv.Item foreign key. Run the following SQL statement…

SELECT INTERNAL_COL_ID FROM SMSYSDBINFO WHERE View_Name = 'Incident' AND ALIAS = 'Asset Machine Name'

and then using Form Customisation you can add a Customised Toolbar Button of type link on the Incident form to that newly exposed field. Now you can launch the Remote Assistance tool from the incident form, populating the machine name direct from the selected asset!

Hope it helps – as always all comments very welcome!

20 thoughts on “Allowing Remote Assistance to accept the machine name as a parameter

  1. Hi, great site, thanks for info! You can optimize your site as well. In wp-admin go to options – permalinks – and under common options cilck on Date and name based. This way search engines can find you way better:)

  2. Can you post an example of the asp code/file that run builder.exe created? I don’t have Service Desk Express. I’m creating hta file that list info on an AD user and the computer name(s) that they are logged into. I want to be able to click the computer and pass Computer Name to Microsoft’s Remote Assistance tool. I added your modification to the UnSolicitedRCUI.htm onload function. But, if I try to pass any parameters using “htm?” it errors out.
    Error is “Cannot display the page: The page you are trying to view has an incorrect address and cannot be displayed. Please try another “
    Thanks,
    Tom

  3. Hi Tom,

    Unfortunately, it wont do you any good as the builder.exe creates an ASP page that makes use of a bespoke ActiveX control that BMC have developed. As such the ASP page creates an instance of the ActiveX control passing it a parameter of:

    C:WINDOWSPCHEALTHHELPCTRBinariesHelpCtr.exe -url hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/ Remote%20Assistance/Escalation/Unsolicited/ UnsolicitedRCui.htm?machinename

    Regards,

    Alan

  4. Actually, that link help.
    Using your Code in the UnSolicitedRCUI.htm
    if (window.location.search.substring(1)!= “machinename”)
    {
    idComputerName.value = window.location.search.substring(1);
    }
    and modifying the link to:

    %windir%PCHEALTHHELPCTRBinariesHelpCtr.exe -url hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Unsolicited/UnsolicitedRCui.htm?SomeMachineName

    And it works.

  5. I was playing with code some more and found way to pass the Machine or IP and then automatically start the remote session and thought I would post it, incase anyone would like to use it.
    If you change the onload code to the following.
    function onLoad()
    {
    ;
    ;
    try
    {

    //idComputerName.value = “hnlf891”
    setTimeout(“idComputerName.focus()”,250);
    g_oSAFRemoteDesktopConnection = oSAFClassFactory.CreateObject_RemoteDesktopConnection();
    if (window.location.search.substring(1)!= “”)
    {
    idComputerName.value = window.location.search.substring(1); // load the Machine Name
    document.getElementById(‘btnConnect’).click(); // clicks the connect button
    document.getElementById(‘btnStart’).click(); // clicks the Start Remote Assistance button
    }
    }
    catch(error)
    {
    FatalError( L_RCCTL_Text, error );
    }
    ;
    return;
    }

    Now when you send
    %windir%PCHEALTHHELPCTRBinariesHelpCtr.exe -url hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/Remote%20Assistance/Escalation/Unsolicited/UnsolicitedRCui.htm?SomeMachineName

    it automatically start the remote session.

  6. Hi Tom,

    Very glad my postings were of some use – very cool re the remote session functionality. Whilst I don’t have a use for it right now, part of the reason I created this blog was as a storage of useful stuff that I keep having to try and find.

    Thanks again,

    Regards,

    Alan

  7. This was great info… I too was looking for a way to integrate into a 3rd party admin tool.

    I made the following mods to automatically initiate the initial connect (gets you to the point of selecting a user) if a machine name was specified, otherwise it operates OEM…

    function onLoad()
    {
    ;
    ;
    try
    {
    setTimeout(“idComputerName.focus()”,250);
    g_oSAFRemoteDesktopConnection = oSAFClassFactory.CreateObject_RemoteDesktopConnection();
    }
    catch(error)
    {
    FatalError( L_RCCTL_Text, error );
    }
    ;
    if (window.location.search.substring(1)!= “”)
    {
    idComputerName.value = window.location.search.substring(1);
    onConnect();
    }
    return;

  8. Hey Corwin,

    Many thanks for the comments – always welcome. Glad the info was useful – I will have a play with your mods when I have a little more time.

    Thanks again,

    Alan

  9. Hello,

    this looks similar to what I’m looking for. We use an excel worksheet at work to show the last PC name a user was on, which we can then use offer remote assistance to help them. I was looking to add a column with a link or such so I can click it and populate the ComputerName field.

    I vaguely understand the above steps, but a bit of help would be much appreciated.

    Would anyone know how to do this?

    Thanks

  10. Hi RowdyBeans,

    So if you added a column to your spreadsheet that had the following formula:

    =CONCATENATE(“C:WINDOWSPCHEALTHHELPCTRBinariesHelpCtr.exe -url hcp://CN=Microsoft%20Corporation,L=Redmond,S=Washington,C=US/ Remote%20Assistance/Escalation/Unsolicited/ UnsolicitedRCui.htm?”, A1)

    where A1 is your machine name (so obviously change that to whatever your column is).

    That will get you the information you need but if you try to turn that into a hyperlink it will fail. You would need to write some VBA code that on entering that field launches a macro that launches the application using those parameters.

    I am guessing that this is where you are stuck. If I figure out the VBA code I will post it and let you know.

    Sorry if this is not of any help.

    Regards,

    Alan

  11. Im not much a programming geek but recently, i happened to copy paste codes into remote assistance to accept offer without any user interaction on the client side.
    I need one more moification:
    IS THERE A MODIFIED LINE TO KILL/SUPPRESS THE POP-UP MESSAGES THAT APPEAR ON THE CLIENT SIDE??

  12. Hi Alexander,

    When I was originally doing this I had the same problem as I thought it was best to leave the original file alone. It appears that it is not possible to have two files or even rename the existing one – it APPEARS (and I am happy to be corrected) that it has to be called UnsolicitedRCUI.htm

    Sorry about that.

    Regards,

    Alan

  13. Alan, Any chances of doing a similar thing only using the remote feature in Microsoft Systems Center Configuration Manager 2007? When you you install the Config Manager on a workstation, it puts rc.exe in c:program filesMicrosoft Configuration Manager ConsoleAdminUIbini386 – So, I used program builder to create the .asp file to launch remote.exe, added a custom button to call the .asp file – It works fine, but you have to then click on “File, connect” and enter the PC IP or hostname in the dialog box, and click ok – However, the rc.exe can be run with CLI flags to automatically connect – For example, if you create a shortcut to rc.exe and modify the target of the shortcut to read (“c:program filesMicrosoft Configuration Manager ConsoleAdminUIbini386rc.exe” 1 PC_NAME) without the parenthesis it will proceed to connect to PC_NAME. I wonder if there is a way to send the PC_NAME variable through the .asp. Does that make sense?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s