VBScript für die Erstellung des lokalen Kontos und das hinzufügen der admin-Gruppe verwendet, um die Arbeit vor der Anmeldung / Abmeldung zu testen, neu erstellte Konto:

Set objShell = CreateObject("Wscript.Shell")

Set objEnv = objShell.Environment("Process")
strComputer = objEnv("COMPUTERNAME")
strUser = inputbox("Enter the username for the new admin account.")
strPass = inputbox("Enter the password for the new account.")

Set colAccounts = GetObject("WinNT://" & strComputer & ",computer")

Set objUser = colAccounts.Create("user", strUser)

objUser.SetPassword strPass

Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
objPasswordExpirationFlag = ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag

objUser.SetInfo 

Set Group = GetObject("WinNT://" & strComputer & "/Administrators,group")
Group.Add(objUser.ADspath)

InformationsquelleAutor Shawn | 2011-02-11

Schreibe einen Kommentar