User Must Change Password At Next Logon

cjwallace

Member
Joined
May 5, 2007
Messages
13
Programming Experience
Beginner
Hi guys.

I am really stuck and need some help big time.

I have this line of code in my project

user.Properties("userAccountControl").Value = ADS_USER_FLAG.ADS_UF_NORMAL_ACCOUNT Or ADS_USER_FLAG.ADS_UF_PASSWD_NOTREQD Or ADS_USER_FLAG.ADS_UF_PASSWORD_EXPIRED

What i am trying to set is that "User Must Change Password At Next Logon" property when i create my user account.

Can anyone help i just cant get it to put that value in.

Thanks in advance
 
Hi guys.

I am really stuck and need some help big time.

I have this line of code in my project

user.Properties("userAccountControl").Value = ADS_USER_FLAG.ADS_UF_NORMAL_ACCOUNT Or ADS_USER_FLAG.ADS_UF_PASSWD_NOTREQD Or ADS_USER_FLAG.ADS_UF_PASSWORD_EXPIRED

What i am trying to set is that "User Must Change Password At Next Logon" property when i create my user account.

Can anyone help i just cant get it to put that value in.

Thanks in advance

try user.Properties("userAccountControl").Value = 8388608

if that doesnt work try user.Properties("userAccountControl").Value = 0x800000

Let me know if this worked.
 
Hi mate, thanks for the reply.

ok in my code i have

Public Enum enumUserAccountControlFlag
SCRIPT = &H1
ACCOUNT_DISABLED = &H2
HOMEDIR_REQUIRED = &H8
LOCKED_OUT = &H10
PASSWD_NOT_REQD = &H20
PASSWD_CANT_CHANGE = &H40
ENCRYPTED_TEXT_PASSWD_ALLWD = &H80
TEMP_DUPLICATE_ACCT = &H100
NORMAL_ACCOUNT = &H200
INTERDOMAIN_TRUST_ACCT = &H800
WORKSTATION_TRUST_ACCT = &H1000
SERVER_TRUST_ACCT = &H2000
PASSWD_NO_EXPIRE = &H10000
MNS_LOGON_ACCT = &H20000
SMART_CART_REQD = &H40000
TRUSTED_FOR_DELEGATION = &H80000
NOT_DELEGATED = &H100000
USE_DES_KEY_ONLY = &H200000
PREAUTH_NOT_REQD = &H400000
PASSWD_EXPIRED = &H800000
TRUSTED_TO_AUTH_FOR_DELEGATION = &H1000000
End Enum

Then i am using

user.Properties("userAccountControl").Value = ADS_USER_FLAG.ADS_UF_NORMAL_ACCOUNT Or ADS_USER_FLAG.ADS_UF_PASSWD_NOTREQD Or ADS_USER_FLAG.ADS_UF_PASSWORD_EXPIRED

I have tried what you have suggested but still no go. :-(

Thanks for your help so far, is there anything else you can think of?
 
Hi mate.

I get

The server is unwilling to process the request. (Exception from HRESULT: 0x80072035)

Any ideas?

Thanks again
 
I tried the following

user.Properties("passwordExpired")(0) = 1

but i get the following error message

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
 
i also noticed the following.

If i create the account and then look in adsiedit.msc the following

msDS-User-Account-Control-Computed has a value of 0

If i go into the account and manullay tick the box User must Change Password at next logon it get a value of 8388608

Any ideas? , can i set this with vb.net?
 
Back
Top