![39872](/images/members/profile_male_64x64.png)
39872
11.12.2006, aktualisiert am 30.01.2007
W2k3 - User mittels VB-Script aus Excel Tabelle erstellen
Hallo,
Ich versuche mich das erste Mal an der Accounterstellung mittels VB-Script.
Das Script ist eine Vorlage gewesen, welche ich nur versucht habe meinen Bedürfnissen anzupassen.
Nun habe ich ein paar Fragen:
1. Wie hinterlege ich für jeden User ein eigenes Passwort aus der Excel Tabelle (min. 7 Zeichen)?
2. Wie definiere ich die Gültigkeit des Kontos (1 Jahr ab Erstellung)?
3. Wie weise ich dem User zusätzlich eine Gruppe zu?
4. Wie aktiviere ich die Konten bei der Erstellung?
5. Wie weise ich als Land Deutschland zu?
Danke für die Mühe
PS: Hier noch mal das Script
http://nopaste.easy-coding.de/?id=708
Ich versuche mich das erste Mal an der Accounterstellung mittels VB-Script.
Das Script ist eine Vorlage gewesen, welche ich nur versucht habe meinen Bedürfnissen anzupassen.
Nun habe ich ein paar Fragen:
1. Wie hinterlege ich für jeden User ein eigenes Passwort aus der Excel Tabelle (min. 7 Zeichen)?
2. Wie definiere ich die Gültigkeit des Kontos (1 Jahr ab Erstellung)?
3. Wie weise ich dem User zusätzlich eine Gruppe zu?
4. Wie aktiviere ich die Konten bei der Erstellung?
5. Wie weise ich als Land Deutschland zu?
Danke für die Mühe
PS: Hier noch mal das Script
http://nopaste.easy-coding.de/?id=708
Bitte markiere auch die Kommentare, die zur Lösung des Beitrags beigetragen haben
Content-ID: 46520
Url: https://administrator.de/forum/w2k3-user-mittels-vb-script-aus-excel-tabelle-erstellen-46520.html
Ausgedruckt am: 17.02.2025 um 01:02 Uhr
3 Kommentare
Neuester Kommentar
Auch wenn dein Comment schon länger her ist. Vielleicht hilft es anderen.
Ich habe ein Skript erstellt der zumindest Punkt 1/3 und evt 4 lösen kann.
strDomainOrWorkgroup = "Arbeitsgruppe"
'Modify Local User Account Password: It Never Expires
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("c:\Benutzer.xls")
strComputer = objExcel.Cells(1, 2).Value
intRow = 3
Do Until objExcel.Cells(intRow,1).Value = ""
strUser = objExcel.Cells(intRow, 1).Value
strFullname = objExcel.Cells(intRow, 3).Value
strDescription = objExcel.Cells(intRow, 4).Value
Set colAccounts = GetObject("WinNT:" & strComputer & "")
Set objUser = colAccounts.Create("user", strUser)
'Set objFullname= colAccounts.Create("Fullname", strFullname)
objUser.SetPassword objExcel.Cells(intRow, 2).Value
objUser.SetInfo
'objFullname.SetFullname objExcel.Cells(intRow, 3).Value
Set objUser = Nothing
Set colAccounts = Nothing
Set objUser = GetObject("WinNT:" & strDomainOrWorkgroup & "/" & strComputer & "/" & strUser & ",User")
'Set objFullname = GetObject("WinNT:" & strDomainOrWorkgroup & "/" & strComputer & "/" & strFullname & ",Fullname")
objUserFlags = objUser.Get("UserFlags")
objPasswordExpirationFlag = objUserFlags Or ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag
objUser.Put "FullName", strFullname
objUser.Put "Description", strDescription
objUser.SetInfo
Set objUser = Nothing
strGroup = objExcel.Cells(intRow, 5).Value
'strGroup = "Users"
strUser = strUser
Set objGroup_ = GetObject("WinNT:" & strComputer & "/" & strGroup & ",group")
Set objUser_ = GetObject("WinNT:" & strComputer & "/" & strUser & ",user")
'Set objFullname_ = GetObject("WinNT:" & strComputer & "/" & strFullname & "Fullname")
objGroup_.Add(objUser_.ADsPath)
Set objGroup_ = Nothing
Set objUser_ = Nothing
intRow = intRow + 1
Loop
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
'objExcel.Exit
Auszug Formatierung Excel
url: "img90.imageshack.us/my.php?image=excelsm1.png"
Ich habe ein Skript erstellt der zumindest Punkt 1/3 und evt 4 lösen kann.
strDomainOrWorkgroup = "Arbeitsgruppe"
'Modify Local User Account Password: It Never Expires
Const ADS_UF_DONT_EXPIRE_PASSWD = &h10000
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open ("c:\Benutzer.xls")
strComputer = objExcel.Cells(1, 2).Value
intRow = 3
Do Until objExcel.Cells(intRow,1).Value = ""
strUser = objExcel.Cells(intRow, 1).Value
strFullname = objExcel.Cells(intRow, 3).Value
strDescription = objExcel.Cells(intRow, 4).Value
Set colAccounts = GetObject("WinNT:" & strComputer & "")
Set objUser = colAccounts.Create("user", strUser)
'Set objFullname= colAccounts.Create("Fullname", strFullname)
objUser.SetPassword objExcel.Cells(intRow, 2).Value
objUser.SetInfo
'objFullname.SetFullname objExcel.Cells(intRow, 3).Value
Set objUser = Nothing
Set colAccounts = Nothing
Set objUser = GetObject("WinNT:" & strDomainOrWorkgroup & "/" & strComputer & "/" & strUser & ",User")
'Set objFullname = GetObject("WinNT:" & strDomainOrWorkgroup & "/" & strComputer & "/" & strFullname & ",Fullname")
objUserFlags = objUser.Get("UserFlags")
objPasswordExpirationFlag = objUserFlags Or ADS_UF_DONT_EXPIRE_PASSWD
objUser.Put "userFlags", objPasswordExpirationFlag
objUser.Put "FullName", strFullname
objUser.Put "Description", strDescription
objUser.SetInfo
Set objUser = Nothing
strGroup = objExcel.Cells(intRow, 5).Value
'strGroup = "Users"
strUser = strUser
Set objGroup_ = GetObject("WinNT:" & strComputer & "/" & strGroup & ",group")
Set objUser_ = GetObject("WinNT:" & strComputer & "/" & strUser & ",user")
'Set objFullname_ = GetObject("WinNT:" & strComputer & "/" & strFullname & "Fullname")
objGroup_.Add(objUser_.ADsPath)
Set objGroup_ = Nothing
Set objUser_ = Nothing
intRow = intRow + 1
Loop
objExcel.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
'objExcel.Exit
Auszug Formatierung Excel
url: "img90.imageshack.us/my.php?image=excelsm1.png"