Announcement

Collapse
No announcement yet.

VBS -- Example migrate homedrives in userproperties

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS -- Example migrate homedrives in userproperties

    Code:
    ' AUTHOR: Marcel Henderik
    
    ' COMMENT:  Change homedir path in the userproperties when you 
    'manually copy the shares (with hyena for example) and data (with
    'robocopy for example)
    
    
    Set ObjOU= GetObject ("LDAP://OU=USerOU,DC=Test,DC=local")
    
    objOU.filter=array("user")
    For Each ObjUser In ObjOU
    	Home=ObjUser.HomeDirectory
    	WScript.Echo home
    	On Error Resume next
    		If Left (UCase(home),12) = "\\Server001\" then
    			home =Replace (UCase (home) ,"\\SERVER001\","\\Server2\")
    			WScript.Echo home 
    		End If
    	ObjUser.Put "HomeDirectory" , home
    	ObjUser.SetInfo
    Next
    
    Set objOU = Nothing
    Marcel
    Technical Consultant
    Netherlands
    http://www.phetios.com
    http://blog.nessus.nl

    MCITP(EA, SA), MCSA/E 2003:Security, CCNA, SNAF, DCUCI, CCSA/E/E+ (R60), VCP4/5, NCDA, NCIE - SAN, NCIE - BR, EMCPE
    "No matter how secure, there is always the human factor."

    "Enjoy life today, tomorrow may never come."
    "If you're going through hell, keep going. ~Winston Churchill"

Working...
X