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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Move users

Status
Not open for further replies.
Mar 30, 2003
172
NZ
Has anyone got some clever ideas to accomplish the following
Move a user from one file server to another
- Moving the users folder
- Moving the share
- Resetting the Profile dir in AD
- Resetting the Home dir in AD
- Resetting the Terminal Service Profile Dir in AD
- Reset permissions as needed

Thanks all.
 
When you say move a user from one file server to another...are you talking about different domains? Are these workgroup servers or members of a domain?
 
Moving there home drives from one 2k AD Member server to another because we ar eretiring an old server to make way for a box with heaps of shiny new disk.
 
OK, that changes things a bit because you don't need to move the user objects themselves. Rather than use a script to move the data I'd download ROBOCOPY from the Microsoft web site and use it since it has error checking.

You can use the below script to set the Home Drive. Sorry I don't have solutions for the other items at present but this will get you most of the way there.


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

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

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 &quot;Finished :O)&quot;
' 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 &quot;Select Case&quot; 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 &quot;user&quot;' section.


On error resume next


Select Case oObj.Class

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

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

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


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top