Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

network path

Status
Not open for further replies.

kinalas

Technical User
Dec 18, 2002
51
0
0
PH
on my ad user profiles, how can i include the preferred driver (E) to my home directory connect option

if i use \\%servername%/Users/%username%, it creates the folder on my drive C. i want to folder created in drive E

thanks
 
Is this what you are looking for? This script will configure the Home Drive setting within a User Accounts properties in AD.



' Setting Home Directory for multiple users in a specific OU
Dim oContainer

LDAPprefix = "LDAP://"
LDAPsuffix = "OU=<ouName>,DC=<domainName>,DC=<domain>"

Set oContainer=GetObject(LDAPprefix & LDAPsuffix)
' Running the ModifyUsers Subroutine on the container
ModifyUsers(oContainer)
' Clean up
Set oContainer = Nothing
' Display a message box upon operation complete
MsgBox "Finished :O)"
' Close
WScript.Quit

Sub ModifyUsers(oTopLevelContainer) ' oTopLevelContainer is the oContainer object
Dim oObj
' Go into a loop for every object in the container
For Each oObj in oTopLevelContainer
' We use "Select Case" to apply different code/actions to different values of an item. In
' this case, we check every object's Class to apply the actions according to the Object's
' class, e.g. If it's a user object, it goes into the 'Case "user"' section.


On error resume next


Select Case oObj.Class

Case "user"
'MsgBox LDAPprefix & oObj.Name & "," & LDAPsuffix
Set oUser = GetObject(LDAPprefix & oObj.Name & "," & LDAPsuffix)
oUser.Put "homeDirectory","\\serverpath\" + oUser.SamAccountName
oUser.Put "homeDrive", "u:"
oUser.Setinfo

' If it's a container/OU, go into the ModifyUsers loop for every object there
Case "organizationalUnit" , "container"
ModifyUsers(oObj)
End select

' Goes into the next available child object under the container
Next
End Sub




I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top