Enables the User Cannot Change Password option, which prevents the user from changing their password.
Const ADS_ACETYPE_ACCESS_DENIED_OBJECT = &H6Const ADS_ACEFLAG_OBJECT_TYPE_PRESENT = &H1Const CHANGE_PASSWORD_GUID = "{ab721a53-1e2f-11d0-9819-00aa0040529b}"Const ADS_RIGHT_DS_CONTROL_ACCESS = &H100Set objUser = GetObject _("LDAP://cn=myerken,ou=management,dc=fabrikam,dc=com")Set objSD = objUser.Get("ntSecurityDescriptor")Set objDACL = objSD.DiscretionaryAclarrTrustees = array("nt authority\self", "EVERYONE")For Each strTrustee in arrTrusteesSet objACE = CreateObject("AccessControlEntry")objACE.Trustee = strTrusteeobjACE.AceFlags = 0objACE.AceType = ADS_ACETYPE_ACCESS_DENIED_OBJECTobjACE.Flags = ADS_ACEFLAG_OBJECT_TYPE_PRESENTobjACE.ObjectType = CHANGE_PASSWORD_GUIDobjACE.AccessMask = ADS_RIGHT_DS_CONTROL_ACCESSobjDACL.AddAce objACENextobjSD.DiscretionaryAcl = objDACLobjUser.Put "nTSecurityDescriptor", objSDobjUser. SetInfo
This is a VB Script, this can be used by saving the file in .vbs file