Try making this change:
        usr.HomeDirectory = strpath
To
        usr.HomeDirectory = trim(strpath)
Not sure if that will do it, but I wonder if there isn't a trailing
character being stuck in there.

Also, move your objFSO = create... Outside the For...Next loop - that object
only needs to be instantiated once. It also looks like the struser= is an
orphan statement - it never gets used, and that's a fairly costly statement
to execute for ever iteration. Comment it out and see if that speeds things
up.


--------------------------------------------------------------
Roger D. Seielstad - MTS MCSE MS-MVP
Sr. Systems Administrator
Inovis Inc.


> -----Original Message-----
> From: Gasper, Rick [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 07, 2003 11:24 PM
> To: [EMAIL PROTECTED]
> Subject: [ActiveDir] changing home drive problem
> 
> 
> HI all,
> I am moving home folders to a new server. Since I have thousands of
> users I need to script this.
> The script works fine, however the new home folders don't map 
> until I go
> into aduc, make a change to the home folders (add a space to 
> the end of
> the path then delete it) ) and hit apply. I am working with 
> the connect
> to line.
> 
> Does anyone have any ideas why this is and more important: 
> how do I get
> around it? I really don't want to have to open 3000 accts.
> 
> The script is below:
> 
> '********************************************************
> 'script to create home folders on new server
> 'Rick Gasper
> 'Copyright (c) 2003
> '8-7-2003
> ' You may  use, modify, reproduce, and
> ' distribute this script in any way you find useful, provided that
> ' you agree that the copyright owner above has no warranty, 
> obligations,
> ' or liability for such use.
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''
> 
> 'get users from ad
> 
> Set Ulist = GetObject("LDAP://OU=test,ou=User-Accts,DC=home,DC=test";)
> 
> 'startloop
> For Each Usr In Ulist
>     'set useracct variable so that the        
>     useracct = usr.samaccountname
>     struser = "WinNT://server1/" & usr.samaccountname & ",user"
>     strpath = "\\server1\staff$\" & usr.samaccountname
> 
>     usr.HomeDirectory = strpath
>     usr.HomeDrive = "S"
>     usr.SetInfo
> 
>    Set objFSO = CreateObject("Scripting.FileSystemObject")
>    Set objFolder = objFSO.CreateFolder(strpath)
> 
>    Set wshShell = WScript.CreateObject("Wscript.Shell")
> 
>    'create xcalcs scripts
> 
>     struserperms =  useracct & ":rwc /y"
>     stradminperms = " /G administrators:f " & useracct & ":f /y"
> 
>     strperms = "xcacls " & strpath & stradminperms 
>     wshShell.Run strperms
> 
> Next
> 
> 'end here
> Rick Gasper
> Manager of Network Services
> King's College
> Wilkes-Barre PA 18706
> Phone: 570-208-5845
> Fax: 570-208-5989
> [EMAIL PROTECTED]
> 
> 
> List info   : http://www.activedir.org/mail_list.htm
> List FAQ    : http://www.activedir.org/list_faq.htm
> List archive: 
> http://www.mail-archive.com/activedir%> 40mail.activedir.org/
> 
List info   : http://www.activedir.org/mail_list.htm
List FAQ    : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/

Reply via email to