Forum Discussion

Stewart_Hume_24's avatar
Stewart_Hume_24
Icon for Nimbostratus rankNimbostratus
Feb 21, 2016

Using Variables as Entry in a Remote Desktop Hostname Destination

I am trying to set up a process where a visitor validates against an AD Authentication stage which then leads to an LDAP Query that checks membership of a AD Group. (This all works). What I do then is check membership of a group that starts with "CN=RDS-". and then isolate the actual groupname. The groupname is the required Remote Desktop Hostname....

Searching DEVCentral I found some code that appears to be what I need with edits for my variables I entered this into the Branch expression for the Remote Desktop

 

if { [info exists "RDTOP"] }{unset RDTOP;};
foreach value [mcget {session.ad.last.attr.memberOf}] {
    if $value contains "CN=RDS-" regexp {CN=([^,]+)} $value CNFull CNValue;
    set RDTOP= CNValue;
    unset CNFull;
    unset CNValue;
}

 

The variable RDTOP I entered as the Remote Desktop destination Hostname value %{RDTOP}. When looking at the logs I get this

 

Although I get the webtop and Remote desktop Icon The remote desktop appears to start but then errors with cannot connect. Because of the syntax error the Variable RDTOP is not being passed to the hostname destination correctly. Also when looking the session report the session variables in the manage sessions screen returns nothing.. Help!

  1. can you tell me what my syntax error is...
  2. I guess I should ask is this possible, setting the Destination hostname from a variable
  3. is there a simple way to see what the variable RDTOP is being set to?

Thanks for any help!

The novice newbie 🙂

1 Reply

  • A couple things...

    If you log the RDTOP variable (log local0. "RDTOP: $RDTOP), does it show you that value that you expect in the ltm log?

    Also, I think a problem is that you're setting a variable in an iRule, but that variable is not going to be accessible from the RDP profile. What you should do is use ACCESS::session to set a session variable and use that. So you'd add something like this to the iRule: ACCESS::session data set session.custom.rdpname $RDTOP. Then in your RDP resource, you could set the host to %{session.ustom.rdpname}.

    Hope this helps.