[OpenAFS] OpenAFS on windows - profile in AFS, who uses it?

Rodney M. Dyer rmdyer@uncc.edu
Sun, 10 Feb 2008 17:29:07 -0500

At 03:39 PM 2/10/2008, Rodney M. Dyer wrote:
>       When a user is logged on, a global drive cannot be unmounted by the 
> user which is nice. (This assumes they aren't an administrator.)

I'm replying to myself here because I forgot a couple of extra items at 
this point.

When a global drive is mounted, and the user logs on.  If you open an 
Explorer file browser the drive will show up as a "Disconnected Network 
Drive".  You are not able to change the label of this drive because the 
Explorer file browser does not consider that drive as yours, under your 
explorer shell mount table.  This is not a problem however because the 
drive operates as normal.  It's just ugly for the user to see the 
"disconnected" part.  We get questions from our users about this from time 
to time.  Others just don't care.

Related and ugly messy stuff related to the global drive...

If you have roaming profiles for your users, and you are using a global 
drive, then you need to figure out what to do about this registry key...


This is the users explorer shell mount table.  Actually the disconnected 
drive is listed there in the mount table, but the Explorer lists it 
(recreates it) at every logon as a different GUID and so we can't do 
anything with that since we have no idea which GUID is the proper one to 
change (if we want to set a drive label).  As the user logs on and off over 
time this table will normally be managed by the shell for you.  However, if 
you are using global drives, the explorer shell will not ever remove those 
newly created GUIDs and it will begin to fill up over time with registry 
entries.  This is BAD.

At our site, since we have the luxury of being fully in control the users 
desktop experience, I decided to completely erase this folder at every user 
logon, using a user logon script.  Our user logon script runs before the 
explorer shell starts, so there is no interference with explorer while 
performing this deletion.  Since the "MountPoints2" folder is the root of a 
tree of registry keys, you need to delete that folder and everything under it.

I found the "MountPoints2" key quite by accident last year when doing 
research on why a drive label can't be set for "Disconnected Drives".  It 
was then that I observed that it filled up over time.

Once the user is logged on, if you create and other driver mounts to AFS 
for the user in a user logon script, then you CAN set the label 
name.  Here's the code I use for example...

Note:  this is the forced way by direct registry manipulation.  Microsoft 
frowns on this because you aren't supposed to go changing things behind the 
Explorers back, and besides, according to Microsoft you shouldn't change 
anything under their "Microsoft" key anyway.

      Drive mount in user logon script:     net use u: \\afs\%username%

      ntregedt AddValue HKEY_CURRENT_USER 
"_LabelFromReg" REG_SZ "AFS Unix Drive"

Here's the more appropriate programatic way (using vb scripting):

      Set oShell = CreateObject("Shell.Application")
      mDrive = "U:"
      oShell.NameSpace(mDrive).Self.Name = "AFS Unix Drive"

If you've understood this, then you must be sober, so enjoy,