User Profile Management in VDI Deployments

In a “traditional” (as if that word can really be applied to a new technology use-case like this) VDI deployments, we’d use roaming profiles to have users’ settings follow them from hosted desktop to hosted desktop.  In this article using the Flex Profile Kit (FPK) in a VDI deployment, I described an implementation in which roaming profiles couldn’t be used, and so we had to resort to the use of the FPK (which, incidentally, works well).  There is, however, one problem: leftover profiles.

Usually, the FPK is used in conjunction with a mandatory profile and folder redirection, so there isn’t any “stuff” leftover when a user logs in to a desktop.  The FPK pulls down the customized portions of the user’s settings, applies them to a mandatory profile, and off we go.  This is an advantage over roaming profiles, where a local copy of the profile remains even after the user logs off.  (Note that there are Group Policy settings to help control this behavior, if I recall correctly.)

Mandatory profiles, though, go hand-in-hand with roaming profiles; there doesn’t seem to be any way to use one without the other (but not necessarily conversely).  As a result, we settled for a compromise in the form of a few lines in the logout script that deletes certain files and settings that we don’t want to persist between sessions.

Even so, we’ve found that profiles are still accumulating across machines, and occupying more space on the hosted desktops than we’d really prefer.  So we had to come up with a way to get rid of these leftover profile remnants.  That’s where Delprof.exe came in.

Great utility, yes, but almost useless in the logout script because it won’t delete the current user’s profile (as it’s still loaded at that point).  We needed a different way of handling it, so I came up with this little batch file-wannabe that is scheduled to run from the VirtualCenter server on a nightly basis:

dsquery computer “ou=Hosted Desktops,dc=example,dc=com” \
-o rdn > vdi-list.txt
sed -f stripquotes.sed vdi-list.txt > vdi-list2.txt
for /f “tokens=1” %1 in (vdi-list2.txt) do \
delprof.exe /q /i /c:\%1 /d:1

(The lines above were wrapped for readability, with a backslash to indicate the continuation of a line.)  It’s pretty easy to see what this does, but let’s break it down.  First, it uses “dsquery computer” to list all the hosted desktops in the specified OU.  Then, because dsquery returns the computer names inside double quotes and Delprof doesn’t like computer names inside double quotes, we’ll use sed to strip the quotes from the text file.  The “stripquotes.sed” file is a simple regular expression to strip out double quotes.  Finally, we use “for /f” (not seen here on this blog for quite a while now!) to feed the entries of the resulting text file to Delprof.exe to delete all profiles that have been inactive for more than 1 day.

Of course, we could adjust the “/d:1” parameter to keep profiles around longer; that would help balance the disk space used and the time it takes to set up a new profile when a user logs in.  Depending upon the usage profile in your VDI deployment, this may need to be longer.

Tags: , , ,

  1. Patrick Rouse’s avatar

    We make a product that works on Terminal Services that is similar to Logon Consultant’s Flex Profile Kit, however it uses a User Profile Management Service on the Profile Server, and User Profile Agent on the Terminal Server. Other than having a GUI managment console, it works in much the same manner as FPK. One feature that it has is that the agent automatically deletes the user’s profile at logoff.

    This module will be ported from Virtual Access Suite, Enterprise Edition to Virtual Access Suite, Desktop Services Edition (for VDI) in the 3rd quarter of 2008.

    Patrick Rouse
    Microsoft MVP – Terminal Server
    SE, Western USA & Canada
    Quest Software, Provision Networks Division
    Virtual Client Solutions
    (619) 994-5507
    http://www.provisionnetworks.com

  2. Rick Rohne’s avatar

    I’ve run into very similar issues. I ran across a product (AppSense) that works great. It decouples the profile from the user and computer and has other advantouges. AppSense takes a little time to setup but makes user profile management a breeze. I wrote a little blog about it here: http://www.thegenerationv.com/2009/10/theres-appsense-for-that.html

  3. slowe’s avatar

    Rick,

    There are numerous applications available today that help with this sort of issue. At the time this problem was occurring—over 2 years ago—the user profile management market was practically empty.

  4. Rick’s avatar

    Yea, it seems like VDI has really spiked up the idea of “Profile Management”. Although, many of the apps have been around for a while (flex, AppSense, Sepago, User Profile Manager, heck, even Server 2008 and Vista have some new GPO’s to help with VDI).
    I like AppSense because it is event driven rather than just logon logoff driven. Seems to help with the logon times.

    Anyway,
    Thanks