Hopefully this question wont make me look too stupid. But Ive looked around and havent been able to find the answer anywhere. Not saying that its not out there...just havent been able to find it yet and I figure it would be faster to just ask here. Im using the below code to read the contents of an excel spreadsheet, using lonk's readexcel2 udf. Im then using this info to create new AD user accounts accordingly. Im pretty stupid when it comes to LDAP, so here comes my question. The ID's are being created with no problem...But when I look at them in AD, on the account tab, the 'User logon name' is blank and the domain drop down just to the right of that has nothing selected. Only the (pre-windows 2000) login name fields are filled in. Is this normal? If I manually create a user account it does not allow me to finish creating it unless I specify this info so I would think it is important. Am I missing a .Put or something to insert this info?
Here is the code Im trying...
Code:
$users = ReadExcel2(@ScriptDir+'\users.xls',,-1,6)
For $counter=1 to ubound($users,1)
$user = $users[$counter,0]
$domainstring = $users[$counter,5]
$objOU = GetObject($domainstring)
$objUser = $objOU.Create("User", "cn="+$user)
$objUser.Put("sAMAccountName", $user)
$objUser.fullname = $users[$counter,1]
$objUser.firstname = $users[$counter,2]
$objUser.lastname = $users[$counter,3]
$objUser.description = $users[$counter,4]
$objUser.SetInfo
$userpath = Split($domainstring,'//')
$userpath = $userpath[0]+"//cn="+$user+","+$userpath[1]
$objuser2 = getobject($userpath)
$objUser2.AccountLocked=0
$objUser2.AccountDisabled=0
$objuser2.SetInfo
Next