Seen Posted September 17, 2007 Share Posted September 17, 2007 (edited) Hey guys. I'm trying to work on a GUI that acts as a user control panel for Active Directory Management. One of the first things that I'm trying to accomplish is adding a user. Here is my CreateUser() function: Func CreateUser($userid, $firstname, $lastname) $domain = $array_UserControl[1][1] $suffix = $array_UserControl[2][1] $cn = $array_UserControl[3][1] $servername = $array_UserControl[4][1] $defaultpassword = "apassword4u" $objOU = ObjGet("LDAP://cn=" & $cn & ",dc=" & $domain & ",dc=" & $suffix) $objUser = $objOU.Create("User", "cn="& $firstname & " " & $lastname) $objUser.Put ("userPrincipalName", "" & $userid & "@" & $domain & "." & $suffix) $objUser.Put ("sAMAccountName", $userid) $objUser.Put ("profilePath", "\\" & $servername & "\profiles\" & $userid) $objUser.SetPassword ($defaultpassword) $objUser.SetInfo() $objApp = ObjCreate("Wscript.Shell") $objUser.AccountDisabled = 0 $objUser.Put ("pwdLastSet", 0) $objUser.SetInfo() EndFunc However, when I run it, it tells me that when it gets to the SetPassword() part, it fails! No other description aside from that it failed. What am I doing wrong? Every other source and post that I have checked show that I am using the correct syntax. Please help! ~Seen *Edit* I thought I posted this in the General Help and Support. I am reposting it there, feel free to delete this thread. My apologies.* Edited September 17, 2007 by Seen Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now