adding users from file

  • Thread starter Thread starter Bill Morton
  • Start date Start date
B

Bill Morton

I have an Excel spreadsheet consisting of approximately
800 users. This file contains First, Last and login names
as well as passwords. Is there a way to use this file to
initially install/import new users when I install a new
server. It is the first server in a new domain. We are
converting an all Linux network to Windows 2003. Any help
would be much appreciated.

Bill
 
You will need script for that. This one probably has way more stuff then you
need but should give you an idea. The script center will help you with many
tasks like this.
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/default.asp

Const ForReading = 1
Set oFSO = CreateObject("scripting.filesystemobject")
Set oTF = oFSO.OpenTextFile("C:\dealercontact1.csv",ForReading,True)
Do While oTF.AtEndOfStream <> True
sLine = oTF.ReadLine
aLine = split(sline, ",",-1,1)
sCN = aLine(0) & " " & aline(1)
sNick = aline(0) & aline(1)
sPhone = aLine(2)
sCompany = aLine(3)
sTitle = aline(4)
sStreet = aLine(5)
sCity = aLine(6)
sState = aLine(7)
sZIP = aLine(8)
sEmail = lcase(left(aLine(0),1) & aLine(1)) & "@galaxy.nasa"
sWWW = aLine(10)
sLogon = left(aLine(0),1) & aLine(1)
sPass = aLine(11)

Set objOU = GetObject("LDAP://ou=dealers,dc=galaxy,dc=nasa")
Set objUser = objOU.Create("user", "cn=" & sCN)
On Error Resume Next
objuser.put "sAMAccountName", lcase(sLogon)
objuser.put "givenName", aLine(0)
objuser.put "sn", aline(1)
objuser.put "userPrincipalName", lcase(sLogon) & "@galaxy.nasa"
objuser.put "mail", sEmail
objuser.put "mailnickname", sNick
objuser.put "DisplayName", sCN
objuser.put "name", sCN
objuser.put "mobile", sCell
objuser.put "company", sCompany
objuser.put "department", "Dealer"
objuser.put "description", sCompany
objuser.put "proxyAddresses", "SMTP:" & sEmail
objuser.put "targetAddress", "SMTP:" & sEmail
objuser.put "telephoneNumber", sPhone
objuser.put "st" , sState
objuser.put "l", sCity
objuser.put "streetaddress" , sStreet
objuser.put "postalCode", sZIP
objUser.put "c", "US"
objuser.put "title", sTitle
objuser.put "wwwHomePage", sWWW
objuser.AccountExpirationDate = "01/01/1970"
objUser.SetInfo
objUser.setpassword "nasa"
objuser.accountdisabled = FALSE
objUser.SetInfo

Loop
 
Back
Top