Yeah Yeah, I know it's an old thread. However this thread popped up when I was researching home directories with Google. Hopefully I can ease the pain for someone else.

We are moving from individual shares to a master share for all users. The script has to work for all users, no matter if they have been migrated or not. I don't trust that AD will map the user, so I force it. However if the script fails or does not run, AD should still present the home directory.

For some reason @HOMESHR and @LongHomeDir are identical if the home share is not a deep path. They are different if the share is a deep path.

I wanted to query the h:\ drive before deleting it, and compare it to the expected deep path, but I gave up. Anyone have any ideas? I left mapping on for testing purposes

Tested on XP, Win2k, and Vista.

John Wagner

Code follows:


;**************************************************************************
; Home Directories
;**************************************************************************
USE H: /delete /persistent
USE G: /delete /persistent

IF EXIST ("@HOMESHR")
? "Home Share mapped to @HOMESHR."
? "Home path is @LongHomeDir."
sleep 10
if @HOMESHR = @LongHomeDir
use H: @HOMESHR
$error = @ERROR
IF $error = 0
? "Home directory mapped to @HOMESHR."
ELSE
? "Home directory @HOMESHR does not exist or you do not have permission to access it."
SLEEP 5
ENDIF
else
$txtDeepMap = @HOMESHR + "\" + @LongHomeDir
USE H: $txtDeepMap
$error = @ERROR
IF $error = 0
? "Home directory mapped to $txtDeepMap."
ELSE
? "Home directory $txtDeepMap does not exist or you do not have permission to access it."
SLEEP 5
ENDIF
ENDIF
ELSE
? "Home directory does not exist."
ENDIF