VB script

Man of Honour
Joined
17 Nov 2003
Posts
36,747
Location
Southampton, UK
Guys, I need help with a VB script in AD, I need it to be able to change the path of the home directory within the user profile. I need to change the server name but not the share name, so \\tango\share1$ will become \\alpha\share1$.

Any ideas?

Cheers

Burnsy

Edit: the script needs to only target one AD OU and all the users in that OU
 
Last edited:
Can't you just select all the users in that OU and then change the home directory from properties?
 
Found this on the MS site:

Code:
Set objUser = GetObject _
    ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")
 
strCurrentProfilePath = objUser.Get("profilePath")
intStringLen = Len(strCurrentProfilePath)
intStringRemains = intStringLen - 11
strRemains = Mid(strCurrentProfilePath, 12, intStringRemains)
strNewProfilePath = "\\fabrikam" & strRemains
objUser.Put "profilePath", strNewProfilePath
objUser.SetInfo

That should do fine, just needs tweaking.
 
Sure thing. Microsoft Script Repositry, 'tis the way forward. Link :)

Drill down to:
Script Repository > Active Directory > User Accounts > Configuring User Accounts
 
Back
Top Bottom