#88012 - 2002-09-19 06:00 PM
Re: Where are my Values? need help!
|
JJscorpio
Fresh Scripter
Registered: 2002-06-17
Posts: 34
Loc: Houston, Tx
|
Doc, I am building NT users. I cleaned up my script with jpols help, I also got some help from Howard in another post (thought this post was dead, sorry) I found my problem was with $user.setpassword = $value4 changed it to $user.setpassword = "password" and everything worked. final (much cleaner thanks to jopls ) code below:
code:
Break ON CLS
$Class = "C:\training\current_build.xls" ReadData($Class) ? "ID's Have Been Successfully Created"
Function ReadData($Class) $object = CreateObject("Excel.Application") If $Class = "" ? "Class File not found" ? "The Excel File "+$Class+" Must exist before ID Build is run" Goto Clear EndIf ; Open Workbook $_=$object.workbooks.Open ($Class) $Cell = 2 ;Set start value, Row one and two are column and group Headings $x = $object.cells($Cell, 1).value While $object.cells($Cell, 1).value <> "" $Cell = $Cell + 1 If $object.cells($Cell, 1).value = "" Goto Clear EndIf
$value1 = $object.cells($Cell, 1).value ? $value1 $value2 = $object.cells($Cell, 2).value ? $value2 $value3 = $object.cells($Cell, 3).value ? $value3 $value4 = $object.cells($Cell, 4).value ? $value4 $value5 = $object.cells($Cell, 5).value ? $value5 CreateUser ($Value1, $value2, $value3, $value5)
Loop :clear $object.application.Quit $object = "" EndFunction
Function CreateUser ($UserName, $FullName, $Desc, $group)
? "Creating Account..." ;Create the objects Domain and User. $Domain = GetObject("WinNT://CCC,domain") ? "Domain: @error @serror" $User = $Domain.Create("user", $UserName) ? "User: @error @serror" ? "User: @error @serror" $User.SetInfo $User.GetInfo $User.fullName = $FullName ? "Fullname: @error @serror" $User.description = $Desc ? "description: @error @serror" $User.SetPassword = ("password") ? "SetPwd: @ERROR @SERROR" $User.LoginScript = "logon.bat" ? "logon: @error @serror" $User.Put ("PasswordExpired", 1) ? "Password Exp: @error @serror" $User.SetInfo ;Cleanup Objects Domain and User $User = 0 $Domain = 0 ? "ID complete" EndFunction
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
1 registered
(Allen)
and 675 anonymous users online.
|
|
|