Visual Basic Script Active Directory Cambiar Password de un Usuario Política de privacidad de plasticaweb

Academia Plasticaweb

Temas de la semana Visual Basic Script Active Directory Cambiar Password de un Usuario
¿Cómo llegar?:
Pasos :

Private Sub Comando119_Click()

On Error GoTo Err_Comando119_Click

Const ADS_SCOPE_SUBTREE = 2

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand = CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"

objConnection.Open "Active Directory Provider"

Set objCommand.ActiveConnection = objConnection

objCommand.Properties("Page Size") = 1000

objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

Usuario = Me.usuariopan

objCommand.CommandText = _

"SELECT distinguishedName FROM 'LDAP://dc=midominio,dc=com' WHERE objectCategory='user' AND sAMAccountName='" & Usuario & "'"

Set objRecordSet = objCommand.Execute

CANTIDAD = objRecordSet.RecordCount

objUSER.SetPassword "password123"

objUSER.Put "pwdLastSet", 0

objUSER.SetInfo

Exit_Comando119_Click:

Exit Sub

Err_Comando119_Click:

MsgBox Err.Description & Err.Number

Resume Exit_Comando119_Click

End Sub

 

Notas :