title | description | ms.assetid | ms.tgt_platform | keywords | ms.topic | ms.date | ||
---|---|---|---|---|---|---|---|---|
Password Never Expires (LDAP Provider) |
To enable the password never expires option using the LDAP provider, set the ADS\_UF\_DONT\_EXPIRE\_PASSWD flag on the user userAccountControl attribute. |
b8d7e7fe-c846-45c4-9c5f-770530453836 |
multiple |
|
article |
05/31/2018 |
To enable the password never expires option using the LDAP provider, set the ADS_UF_DONT_EXPIRE_PASSWD flag on the user userAccountControl attribute.
Const ADS_UF_DONT_EXPIRE_PASSWD = &H10000
Set usr = GetObject("LDAP://CN=jeffsmith,OU=Sales,DC=Fabrikam,DC=Com")
flag = usr.Get("userAccountControl")
newFlag = flag Or ADS_UF_DONT_EXPIRE_PASSWD
usr.Put "userAccountControl", newFlag
usr.SetInfo
#include <activeds.h>
IADsUser *pUser;
VARIANT var;
VariantInit(&var);
HRESULT hr = S_OK;
LPWSTR adsPath = L"LDAP://serv1/cn=Jeff Smith,cn=Users,dc=Fabrikam,dc=com";
hr = ADsGetObject(adsPath, IID_IADsUser, (void**)&pUser);
hr = pUser->Get(_bstr_t("userAccountControl"), &var);
V_I4(&var) |= ADS_UF_DONT_EXPIRE_PASSWD;
hr = pUser->Put(_bstr_t("userAccountControl"), var);
hr = pUser->SetInfo();
VariantClear(&var);
hr = pUser->Release();