Ok,
I see ... try this one (Made sure that all variables are passed to CreateUser()) :
code:
break on cls
$Class = "C:\training\current_build.xls"
$ = ReadData($Class)
? "ID's Have Been Successfully Created"
exit 1
Function ReadData($Class)
If not exist($Class)
? "Class File not found"
? "The Excel File " + $Class + " Must exist before ID Build is run"
exit ()
EndIf
$xl = CreateObject("Excel.Application")
; Open Workbook
$ = $xl.Workbooks.Open($Class)
$Cell = 3 ;Set start value, Row one and two are column and group Headings
while $xl.Range("A"+$Cell+"").value
$value1 = $xl.Range("A"+$Cell+"").value
$value2 = $xl.Range("B"+$Cell+"").value
$value3 = $xl.Range("C"+$Cell+"").value
$value4 = $xl.Range("D"+$Cell+"").value
$value5 = $xl.Range("E"+$Cell+"").value
$ = CreateUser ($Value1, $Value2, $Value3, $Value4, $Value5)
$Cell = $Cell + 1
loop
$xl.UserControl = 1
$ = $xl.Quit
$xl = ""
endfunction
Function CreateUser ($Name, $FullName, $Desc, $pwd, $Group)
? "Creating Account..."
;Create the objects Domain and User.
$Domain = GetObject("WinNT://CCC,domain")
$User = $Domain.Create("user", $Name)
;Set user account flags.
$User.FullName = $FullName
$User.Description = $Desc
$User.SetPassword = $pwd
$User.LoginScript = "logon.bat"
$User.Put ("PasswordExpired", 1)
;add the user to group here !
$User.SetInfo
;Cleanup Objects Domain and User
$Domain = 0
$user = 0
? "ID complete"
EndFunction