Hier dervb Code:
Dim fso, f, Zeile, Feld
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile ("user.txt",1,0)
Do While Not f.AtEndOfLine
Zeile = f.readLine
Feld = Split(Zeile,",")
Benutzer = Feld(0)
Vorname = Feld(1)
Nachname = Feld(2)
Passwort = Feld(3)
GroupObj = Feld(4)
Call BenuntzerAnlegen(Benutzer,Vorname,Nachname,Passwort,GroupObj)
Loop
f.Close
WScript.Quit(0)
Sub BenuntzerAnlegen (Benutzer,Vorname,Nachname,Passwort)
Dim ouo, b
Set ouo = GetObject("LDAP://OU=Benutzer,OU=Standort1,DC=testdom,DC=local")
Set b = ouo.Create("user", "CN=" & Vorname & " " & Nachname)
Dim WshShell, ret
Set WshShell = WScript.CreateObject("WScript.Shell")
b.Put "sAMAccountName", Benutzer
b.Put "userPrincipalName", Benutzer & "@quisodom.local"
b.Put "profilePath", "\\terminal\daten\profile\" & Benutzer
b.Put "homeDirectory", "\\terminal\daten\home\" & Benutzer
b.Put "homeDrive", "f:"
b.SetInfo
b.SetPassword Passwort
b.AccountDisabled = False
b.Put "pwdLastSet", 0
b.TerminalServicesHomeDirectory = "\\terminal\daten\home"
b.TerminalServicesHomeDrive = "t:"
b.TerminalServicesProfilePath = "\\terminal\daten\profile"
b.SetInfo
WScript.Sleep(1000)
ret = WshShell.Run ("verz.cmd " & Benutzer,0,1)
Set GroupObj = GetObject("" &"WinNT://" & DomainString &"/"& GroupString &"")
GroupObj.Add (""&"WinNT://"& DomainString &"/"& UserString &"")
Set DomainObj = Nothing
Set GroupObj = Nothing
End Sub
Hier meine user.txt
mmustermann,Max,Mustermann,muster,Gruppe1
kmusterfrau,karla,musterfrau,frauenpower
hhubertus,Heinz,Hubertus,123456,Administratoren