Hey I want to use the date out of a txt file in my VBS script what i gotso far is :
Do while not f.AtEndOfLine
Zeile = f.readLine
Feld = split(Zeile,",")
Benutzer = Feld(0)
Gruppe = Feld(1)
Nachname = Feld(2)
Passwort = Feld(3)
ScriptP = Feld(4)
Projekt = Feld(5)
Datum = Feld(6)
Call BenuntzerAnlegen(Benutzer,Gruppe,Nachname,Passwort,ScriptP)
Loop
and It works so fat but the date doesn ist written like this: DD/MM/YYYY in the txt example: AJWKW24Sr1fe,Polo,Rsafa,AMam140981,AJWTN_Logon.cmd,23.06.2016,AJW
I wanted to use it with this :
Sub BenuntzerAnlegen (Benutzer,Gruppe,Nachname,Passwort,ScriptP)
Dim ouo, b
Set ouo = GetObject("LDAP://OU=Gruppinsr,DC=ipcenter,DC=local")
Set b = ouo.Create("user", "CN=" & Gruppe & " " & Nachname)
Dim WshShell, ret
Set WshShell = WScript.CreateObject("WScript.Shell")
set objUser = GetObject("LDAP://OU=Gruppinsr,DC=ipcenter,DC=local")
b.Put "sAMAccountName", Benutzer
b.Put "userPrincipalName", Benutzer & "@ipcenter.local"
b.Put "scriptPath", ScriptP
b.SetInfo
b.SetPassword Passwort
b.AccountDisabled = False
b.AccountExpirationDate = Datum
b.SetInfo
But it doesnt work it Keep telling me missing string or "types mismatch"
Datum
in SubBenuntzerAnlegen
? Have you created it as global variable? – ManishChristianDim fso, f, Zeile, Feld Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.OpenTextFile ("C:\user.txt",1,0)
– NirispaDatum
passed, so have you created it as global variable? HowDatum
is getting value? – ManishChristian