I wanted to do one OU at a time.I've been able to do everything I wanted EXCEPT rename user objects. Still working on that and would appreciate any advice. Here is a working (though ROUGH) copy of the code. Once it is polished, I'll post the final copy:
GO.KIX
BREAK ON
$ou = olegetobject(0,"LDAP://OU=Admin,OU=texas,DC=texasisd,DC=net")
$enum = oleenumobject($ou)
$object = oleenumobject($ou,$enum)
; chr(34) = "
$q = chr(34)
; chr(36) = $
$d = chr(36)
use x: /del
use x: "\\aisd-texas\admin"
while $object
if olegetproperty($object,"class") = "user"
$name = olegetproperty($object,"name")
$firstname = olegetproperty($object,"firstname")
$lastname = olegetproperty($object,"lastname")
$flname = $firstname +" "+ $lastname
$nlen = len($name)
$tname = LTRIM(SUBSTR($name, 4, $nlen))
$newname = $q + $flname + $q
$sharename = $q +$flname + $d +$q
?
?"name=$name"
?"firstname=$firstname"
?"lastname=$lastname"
?"tname=$tname"
?"newname=$newname"
?"flname=$flname"
?"sharename=$sharename"
;*********************************************************************
; go1.kix
; Grant the user rights to his home directory
;*********************************************************************
run "xcacls \\aisd-texas\admin\$tname /e /g $tname:c /y"
Sleep 1
;*********************************************************************
; go2.kix
; Change the home directory name to Firstname Lastname format
;*********************************************************************
if $firstname = "" or $firstname =" " or $lastname = "" or $lastname = " "
?"Not renaming home directory $tname to $newname"
else
run "rename.bat $tname $newname"
Sleep 1
endif
;*********************************************************************
; go3.kix
; Share the home directory as Firstname Lastname$
;*********************************************************************
if $firstname = "" or $firstname =" " or $lastname = "" or $lastname = " "
?"Not sharing : $tname"
else
run "share.bat $sharename $newname"
sleep 1
endif
;*********************************************************************
; Give all the users the same login script
;*********************************************************************
run "cusrmgr -u $tname -m \\aisd-texas -n aisd.bat"
;*********************************************************************
; Change the userid to firstname lastname format
; This is only changing the pre-windows 2000 name for some reason
;*********************************************************************
; if $firstname = "" or $firstname =" " or $lastname = "" or $lastname = " "
; ?"Not renaming : $tname to $flname"
; else
; run "cusrmgr -u $tname -m \\aisd-texas -r $newname"
; sleep 1
; endif
endif
$object = oleenumobject($ou,$enum)
loop
exit
******************************
RENAME.BAT
x:
cd \
rename %1 %2
******************************
SHARE.BAT
cscript share.vbs /C /N %1 /P D:\Data\Admin\%2 /S AISD-TEXAS /t disk