Chris S. posted this a while back as well. Seems to work well to retrieve the dept of the user thats loggin in.

Code:

$username = @USERID
$objADSystemInfo = CreateObject("ADSystemInfo")
$user = GetObject("LDAP://" + $objADSystemInfo.UserName)
$dept = $user.Department

USE U: "\\server\userdirs$$\"+$dept+"\"+$username



edited since you showed more of what you were doing


Edited by CitrixMan (2004-11-11 08:12 PM)