Jump to content
Sign in to follow this  

AD udf - change password

Recommended Posts


UDF: '?do=embed' frameborder='0' data-embedContent>>

I'm using this, to change the password for a user, and it works, but I want it to enable the option

"user must change password at next logon"

I heart it would do the trick, by adding: ,1

but it still doesen't force the user to create a new password at next logon.

Global $iValue = _AD_SetPassword($sUser, $sPassword,1) 

anyone know what might be the problem?

this is the script I use:

Case $change_pass
    $readit = GUICtrlRead($machinename)


    $get_user = InputBox("skift password","Ændre brugerens password til: Abcd1234","Initialer")

    Global $sUser = _AD_SamAccountNameToFQDN($get_user)
    Global $sPassword = "Abcd1234"

    ; Set the password
    Global $iValue = _AD_SetPassword($sUser, $sPassword,1)
    If $iValue = 1 Then
    MsgBox(64, "password ændret", "passwordet er ændret til: Abcd1234")
    ElseIf @error = 1 Then
    MsgBox(64, "Fejl", "den indtastede bruger eksisterer ikke.")
    MsgBox(64, "Fejl", "Du har ikke rettigheder til at ændre passwordet.")

; Close Connection to the Active Directory
Edited by legend

Share this post

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this