This topic describes how to customize Remote Desktops published through Forefront Unified Access Gateway (UAG) using the Remote Desktop (User defined) template.

The following customization options are possible for this template:

Note:
These procedures assume that you have already published the application through Forefront UAG. These procedures also use the CustomUpdate mechanism. For information about the CustomUpdate mechanism, see About the CustomUpdate mechanism.

Connecting automatically to a remote desktop host

In cases where you can determine the remote desktop host to which an end user can connect, you can customize the published application to automatically connect to the host when the user clicks the portal link.

If you publish several remote desktop applications through the Forefront UAG portal, you can customize the portal to connect end users automatically to a different host, based on the application that is selected by the end user.

Note:
This type of customization takes precedence over customizations that set the RDHosts variable, as described in Connect automatically to a host determined during user login Show a list of available remote desktop hosts.

To automatically connect to a host

  1. In the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate\ folder, create a file that is named rdpdata.inc.

    Note:
    If the customization is for a specific trunk, name the file <trunk_name>1rdpdata.inc.
  2. In the rdpdata.inc file, assign an IP address or computer name to the uagtssrv variable:

      Copy Code
    <%
    set usrinfo = GetSessionLeadUser(g_cookie)
    
    if usrinfo.Domain = "mydomain1" then
    	uagtssrv = usrinfo.User & "-desktop"
    else
    	uagtssrv = "192.168.1.112"
    end if
    %>
    

    This example assumes that all members of the domain “mydomain1” have a desktop computer with a name “username-desktop”. After clicking the remote desktop link in the portal, end users who are members of mydomain1 are automatically connected to their remote desktop; other users are automatically connected to the desktop at 192.168.1.112.

Connecting automatically to a host determined during user login

You can customize the Forefront UAG login process to determine the hosts that will be available to users when they use the remote desktop applications.

To connect automatically to a host determined during user login

  1. In the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate\ folder, create a file that is named PostPostValidate.inc.

    Note:
    If the customization is for a specific trunk, name the file <trunk_name>1PostPostValidate.inc.
  2. In the PostPostValidate.inc file, use the SetSessionParam function to assign an IP address or computer name to the RDHosts variable:

      Copy Code
    <%
    set usrinfo = GetSessionLeadUser(g_cookie)
    
    if usrinfo.Domain = "mydomain1" then
    	SetSessionParam g_cookie, "RDHosts", usrinfo.User & "-desktop"
    else 
    	uagtssrv = "192.168.1.112"
    end if
    %>
    

    When end users click the link in the portal, they are connected automatically to the host defined by the RDHosts variable.

Showing a list of available remote desktop hosts

In some situations, an end user may require remote access to several remote desktop hosts. After customizing the behavior of the template, when the end user clicks the portal link, a dialog box appears that displays a list of desktops to which the user can connect.

If you publish several remote desktop applications through the Forefront UAG portal, you can customize the portal to show a different list of hosts, based on the application selected by the end user.

Note:
The following examples determine the available hosts when the end user logs in to the portal. You can use the examples in Connect automatically to a remote desktop host to determine the available hosts when the user clicks the application link in the portal.

To show a list of available hosts

  1. In the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate\ folder, create a file that is named PostPostValidate.inc.

    Note:
    If the customization is for a specific trunk, name the file <trunk_name>1PostPostValidate.inc.
  2. In the PostPostValidate.inc file, use the SetSessionParam function to assign a list of semicolon separated IP addresses or computer names to the RDHosts variable:

      Copy Code
    <%
    set usrinfo = GetSessionLeadUser(g_cookie)
    
    if usrinfo.Domain = "mydomain1" then
    	SetSessionParam g_cookie, "RDHosts", usrinfo.User & "-desktop;" & usrinfo.User & "-lab"
    else
    	uagtssrv = "192.168.1.112;192.168.1.113;192.168.1.114"
    end if
    %>
    

    When the end user clicks the link in the portal, a dialog box appears with the list of available desktops.

    Note:
    If you assign only one IP address or computer name to the RDHosts variable, when the end user clicks the portal link, the remote desktop host opens automatically.

To show a list of available hosts (application specific)

  1. In the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate\ folder, create a file that is named PostPostValidate.inc.

    Note:
    If the customization is for a specific trunk, name the file <trunk_name>1PostPostValidate.inc.
  2. In the PostPostValidate.inc file, use the SetSessionParam function to assign a list of semicolon separated IP addresses or computer names to the RDHosts.<Application_ID> variable:

      Copy Code
    <%
    ' In this sample, the trunk name is "UAGTrunk" and the names of the published Remote
    ' Desktop application is "Rm Desk 02" (the RDP application is
    ' built from these names and is written in the file:
    ' ...Microsoft Forefront Unified Access Gateway\common\conf\rmapplist.cfg).
    
    set usrinfo = GetSessionLeadUser(g_cookie)
    
    if usrinfo.Domain = "mydomain1" then
    	SetSessionParam g_cookie, "RDHosts.UAGTrunk__Rm_Desk_02__uag_selective_remote_desktop", usrinfo.User & "-desktop;" & usrinfo.User & "-lab"
    else 
    	SetSessionParam g_cookie, "RDHosts.UAGTrunk__Rm_Desk_02__uag_selective_remote_desktop", "192.168.1.112;192.168.1.113;192.168.1.114"
    end if
    %>
    

    When users who are members of mydomain1 click the link in the portal, a dialog box appears with the list of available hosts. Users who are not members of mydomain1 are presented with a dialog box that displays a different list of available hosts.

    Note:
    If you assign only one IP address or computer name to the RDHosts variable, when the end user clicks the portal link, the remote desktop opens automatically.

Customizing the selection dialog box

Forefront UAG allows you to customize the selection dialog box that appears when users connect to multiple remote desktops.

To customize the selection dialog box

  1. Copy the file rdpselect.inc from the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\ folder to the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate folder.

    Note:
    If the customization is for a specific trunk, name the file <trunk_name>1rdpselect.inc.
  2. Make changes to the rdpselect.inc file to suit your requirements.

    Note the following:

    • The function finalizeSelectRemoteDesktop is required to return the currently selected IP or computer name to the portal.

    • The function parent.onSubmitSelection can be used to report to the portal the host selected by the end user.

    • The function parent.onCancelSelection can be used to report to the portal that the user cancelled the selection of a host.

  3. To customize the size of the dialog box, do one of the following:

    • Assign the size of the dialog box to the uagselargs variable in the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate\rdpdata.inc file.

        Copy Code
      uagselargs="340;70"
      
    • Assign the size of the dialog box to the RDHostDialogProperties variable in the ...Microsoft Forefront Unified Access Gateway\von\InternalSite\inc\CustomUpdate\Login.inc file.

        Copy Code
      RDHostDialogProperties="340;70"