StewartCate Posted April 14, 2011 Posted April 14, 2011 I've got a stand alone windows 2003 server whos functions are being migrated to another 2003 server, again stand alone and non-DC.The current server has several hundread users on it which I've exported as a simple list of usernames and as an excel sheet with "username" "fullname".I've managed to cobble together a script that'll create all the local users and then another that a second to drop them into the correct groups.Create usersstrComputer = "lmuklap"strServerListFile="user.txt"set fs = CreateObject("Scripting.FileSystemObject")set fl = fs.openTextFile(strServerListFile)while not fl.atEndOfStreamstrUser=fl.readLine'wscript.echo strUserSet colAccounts = GetObject("WinNT://" & strComputer & "")Set objUser = colAccounts.Create("user",strUser)objUser.SetPassword "password"objUser.SetInfoobjUser.Put "PasswordExpired", 1objUser.SetInfowendfl.closewscript.echo "done"Add to groupsstrComputer = "lmuklap"strServerListFile="user.txt"strGroup = "users"set fs = CreateObject("Scripting.FileSystemObject")set fl = fs.openTextFile(strServerListFile)while not fl.atEndOfStreamstrUser =fl.readLine' Get group objectSet objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ",group")' Get user objectSet objUser = GetObject("WinNT://" & strComputer & "/" & strUser & ",user")' Add user to groupobjGroup.Add(objUser.ADsPath)wendfl.closewscript.echo "Done"Firstly I know this is somewhat rough so anypointers are apprecieated.Ideally I'd like to be able to pull the user list from an xls file and refference colum A (username) and colum B (full name) to get both fields added when creating the user account.If there's a way of merging the two scripts too with the addition of adding the users to a second group, that'd be handy.Advice please of wise internet.
jaclaz Posted April 14, 2011 Posted April 14, 2011 If I were you I would rather check for available solutions, first :http://www.rlmueller.net/freecode4.htmjaclaz
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now