<img alt="" src="https://secure.inventive52intuitive.com/789747.png" style="display:none;">
Detecting VDI and/or laptop sessions in AppSense

Detecting VDI and/or laptop sessions in AppSense

Posted by HTG

AppSense has a lot of built-in Conditions that help you customize various settings for your environment. However, some of the conditions you might like to find aren’t provided out-of-the-box, simply because the developers haven’t seen enough of a requirement to put them into the software yet. Until they do, though, the native tools can allow you to perform all sorts of custom detections if you put enough thought into them.

The issue we are going to look at as an example is a requirement I came across recently whilst doing some consultative work. The client wished to be able to differentiate user sessions based around the criteria that they were a) connecting directly using an AppSense-managed laptop, or b) connecting from an AppSense-managed VDI session, specifically Citrix XenDesktop.

The thinking around this was that there would be certain settings that would be only deployed if either of these two scenarios met the given criteria. There would be specific optimizations applied if users were using XenDesktop sessions or a physical laptop connection. There was a school of thought that simply said the optimizations should be applied globally, but that cuts against the whole grain of the AppSense solution. The idea is that every individual setting is only applied if it is specifically required by the session – “just in time, not just in case”, as the mantra from AppSense goes.

Firstly, how to detect a XenDesktop session? There’s no Condition (as yet) in AppSense that lets you differentiate on this level, so we would need to find something that’s unique to each XenDesktop session.

Initial thinking centred around a particular file and/or Registry key that would be only present on XD clients. Luckily I’d come across this requirement previously and with a quick bit of help from general-all-round-helpful-bloke Richard Thompson of AppSense, he swiftly informed me of a Registry value that would be of help in this situation

What we need is a Condition that checks for a Registry value, in this case

Or, alternatively, a File Exists Condition

These values should only be present on XenDesktop-based endpoints, hopefully confirmed by any testing that you will then do. Obviously as software evolves and is upgraded, with this sort of custom detection the onus is on yourself as the administrator to ensure that the detection continues to function from version to version. This is why a Condition native to the AppSense software is obviously more desirable, but in the absence of this currently being available, this is the most robust way to perform it.

Now you can deploy any settings you require that are specific to XenDesktop sessions simply by nesting them under this particular Condition.

And onto the next requirement – that of detecting a laptop endpoint. This is, at first glance, a bit more tricky. How do you differentiate a laptop from any other endpoint? Filtering by OS is obviously no good. If you’re lucky enough to have an AD environment where laptops are named with a particular convention, then you could do it by name, but if you don’t, it seems a bit trickier.

One of the ways I’ve heard of this being done is by using a WMI query to see if a battery is present. At the moment, this seems quite good, but I can’t help think with the explosion in tablet computing (and particularly the imminent arrival of Windows-based tablets) that this may affect the reliability of this query in the fairly near future. But for now – you can use this query provided by App-V MVP Aaron Parker, which in turn owes credit to Rob van der Woude, a man whose website I used to rely on for great tips on batch file scripting back in the NT4 days 🙂

You will need to create a custom Condition and insert this VB script

If IsLaptop( “.” ) Then
    ‘ WScript.Echo “Laptop”
    ‘ Return Success
    WScript.Quit 0
Else
    ‘ WScript.Echo “Desktop or server”
    ‘ Return failure
    WScript.Quit 1
End If

Function IsLaptop( myComputer )
‘ This Function checks if a computer has a battery pack.
‘ Argument:    myComputer    [string] name of the computer to check, or “.” for the local computer
‘ Written by Rob van der Woude
‘ http://www.robvanderwoude.com
    On Error Resume Next
    Set objWMIService = GetObject( “winmgmts://” & myComputer & “/root/cimv2” )
    Set colItems = objWMIService.ExecQuery( “Select * from Win32_Battery”, , 48 )
    IsLaptop = False
    For Each objItem in colItems
        IsLaptop = True
    Next
    If Err Then Err.Clear
    On Error Goto 0
End Function

and ensure that the Options box is set to Run As System as shown below

and now you will have a Condition that can evaluate whether your user is connecting from an AppSense-enabled endpoint that is a laptop, as opposed to a standard desktop or thin client.

The object of this post is really to illustrate that with a bit of research, you can perform any custom detections you require, even if they are not built-in to the Conditions available through the AppSense software. Support for VB, PowerShell and JScript allows you to evaluate settings that you may have thought were beyond the scope of the software. It’s not simply a case of “what does the AppSense Management Suite do?”, more of “what can I do with the AppSense Management Suite?” As the current computing landscape evolves, I’m hoping that the things you can do with the software continue to adapt to allow us to enable users in ways that we hadn’t thought previously possible.

EDIT – the latest version of AppSense DesktopNow 8.x and 10.x both now provide built-in detection of laptops and VDI sessions. So this is all kind of redundant now! 🙂

Contact

Want to partner with us?

Get in touch to learn more about our services or arrange a free 30-minute consultation with one of our Secure Cloud Experts.

Get in touch
HTG - Contact CTA