Jump to content

AD udf - change password


legend
 Share

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)

    _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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...