zippyinuk
{ USER }
posts: 3
last: 19-Sep-2007
TITLE: Create User Accounts Based on Information in a Spreadsheet
DESCRIPTION: Create User Accounts Based on Information in a Spreadsheet
Submitted: 19-Sep-2007 10:10:44 ( 1yrs 15w 5d 20h ago ) Language: VBScript (*.vbs *.vbe)
Views: 205 Lines of Code: 30 LINES
Rating:
rate: star1
star2
star3
star4
star5
dstar1
dstar2
dstar3
dstar4
dstar5  ( rated! )
  { 0.00 / 5 }
Difficulty: Beginner
Bookmark
/* Author: Zippy
   Date: 19-09-2007
   Filename: 
   Description: Create User Accounts Based on Information in a Spreadsheet
   History: 
*/


Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open _
    ("C:\Scripts\New_users.xls")

intRow = 2

Do Until objExcel.Cells(intRow,1).Value = ""
    Set objOU = GetObject("ou=Finance, dc=fabrikam, dc=com")
    Set objUser = objOU.Create _
        ("User", "cn=" & objExcel.Cells(intRow, 1).Value)
    objUser.sAMAccountName = objExcel.Cells(intRow, 2).Value
    objUser.GivenName = objExcel.Cells(intRow, 3).Value
    objUser.SN = objExcel.Cells(intRow, 4).Value
    objUser.AccountDisabled = FALSE
    objUser.SetInfo
    intRow = intRow + 1
Loop

objExcel.Quit


// CODE