Hi folks. I'm using the following script to change the home directory attributes for all the users in a given Active Directory OU:
Set OU = GetObject("LDAP://OU=users,OU=schoolname,OU=schools,DC=test,DC=elc")
For Each objUser In OU
If objUser.Class = "user" Then
objUser.Put "homeDirectory", "\\dc\" + objUser.SAMAccountName
objUser.Put "homeDrive", "Z"
objUser.SetInfo
End If
Next
WScript.echo "OU has been updated!"
WScript.quit
The script changes the attributes as expected. However, after the script has been run, the home dir is not mapped at logon. The only way to make it start working is to open the user in AD, edit the home directory in any way (i.e. add a space to the end and then delete it again), and apply the "changes" - after this, the home dir is mapped at logon correctly. Any ideas?
Set OU = GetObject("LDAP://OU=users,OU=schoolname,OU=schools,DC=test,DC=elc")
For Each objUser In OU
If objUser.Class = "user" Then
objUser.Put "homeDirectory", "\\dc\" + objUser.SAMAccountName
objUser.Put "homeDrive", "Z"
objUser.SetInfo
End If
Next
WScript.echo "OU has been updated!"
WScript.quit
The script changes the attributes as expected. However, after the script has been run, the home dir is not mapped at logon. The only way to make it start working is to open the user in AD, edit the home directory in any way (i.e. add a space to the end and then delete it again), and apply the "changes" - after this, the home dir is mapped at logon correctly. Any ideas?