Sign in to follow this  
Followers 0
legend

AD udf - change password

1 post in this topic

#1 ·  Posted (edited)

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)

    _AD_Open()

    $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.")
    Continueloop
    Else
    MsgBox(64, "Fejl", "Du har ikke rettigheder til at ændre passwordet.")
    EndIf

; Close Connection to the Active Directory
_AD_Close()
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  
Followers 0