![]() |
![]() |
ICC Home / Members / Meetings / Peer Support / Documentation / Projects
Proposed script for |
CreateProfilesFolders Script
Set objShell = CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
Set InputFile = objFileSystem.OpenTextFile("C:\Scripts\CreateProfileFolders\CreateProfileFolders.txt")
InputText = InputFile.ReadAll
InputLines = split(InputText, vbCrLF)
For Each OU in InputLines
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = "Select sAMAccountName from 'LDAP://OU=" & OU & ", OU=IFAS, OU=People, OU=UF, DC=AD, DC=UFL,DC=EDU' where objectClass='user'"
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
Gatorlink = objRecordSet.Fields("sAMAccountName").Value
If objFileSystem.FolderExists("e:\data\" & OU & "\Users\" & Gatorlink) = FALSE Then
Set NewFolder = objFileSystem.CreateFolder("e:\data\" & OU & "\Users\" & Gatorlink)
Permmission = objShell.Run ("cscript c:\xcacls\xcacls.vbs e:\data\" & OU & "\Users\" & Gatorlink & " /G UFAD\" & Gatorlink & ":M /E", 1, TRUE)
objFileSystem.CopyFolder "e:\data\" & OU & "\Users\Template\*", "e:\data\" & OU & "\Users\" & Gatorlink & "\"
End If
objRecordSet.MoveNext
Loop
Next
|
last edited 13 May 2006 by Steve Lasley