473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

AD user flags

In an aspx web page, I'm trying to read out some attributes regarding
password settings like UF_PASSWD_NOTREQD, UF_PASSWD_CANT_CHANGE,
UF_DONT_EXPIRE_PASSWD and UF_PASSWORD_EXPIRED.

According to the documentation userAccountControl seems to be an integer
containing these. However only the bit UF_DONT_EXPIRE_PASSWD seems to be
updated properly. The other three flags are reset no matter what I do to the
user account. Using ADSI Edit it seems like
"msDS-User-Account-Control-Computed" can be used to determine
UF_PASSWORD_EXPIRED, but trying to read this attribute using DirectoryEntry
etc. causes an exception to occur.
iFlags =
(int)objAccount.Properties["msDS-User-Account-Control-Computed"].Value;

It seems like this attribute is not in the collection.

How should I read these properties in asp.net ???
Thanks in advance,
Jan Nielsen
Nov 18 '05 #1
9 6126
Hi Jan,

Based on my understanding, you want to get some password related flags of
certain user.

I think you should use userAccountControl property to get these flags
instead of using "msDS-User-Account-Control-Computed".

Also, after you change your user account, it may need a little time to
update the property. So you should re-query the change some time later.

Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #2
Hi Jan,

Based on my understanding, you want to get some password related flags of
certain user.

I think you should use userAccountControl property to get these flags
instead of using "msDS-User-Account-Control-Computed".

Also, after you change your user account, it may need a little time to
update the property. So you should re-query the change some time later.

Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #3
Hi Jeffrey,

Thanks for your reply.

I've now tried to wait for a few hours, and neither the
UF_PASSWD_CANT_CHANGE (0x0040) bit nor
UF_PASSWORD_EXPIRED (0x800000) bit gets updated in userAccountControl.

I'm sure it's not caused by replication delay, as I'm updating and querying
the same DC. And the UF_DONT_EXPIRE_PASSWD (0x10000) bit gets updated right
away.

For a user that have "User cannot change password" and "Password never
expires" checked, the value I read in userAccountControl is 0x10200. I would
expect it to be 0x10240.
Kind regards,
Jan Nielsen
Nov 18 '05 #4
Hi Jeffrey,

Thanks for your reply.

I've now tried to wait for a few hours, and neither the
UF_PASSWD_CANT_CHANGE (0x0040) bit nor
UF_PASSWORD_EXPIRED (0x800000) bit gets updated in userAccountControl.

I'm sure it's not caused by replication delay, as I'm updating and querying
the same DC. And the UF_DONT_EXPIRE_PASSWD (0x10000) bit gets updated right
away.

For a user that have "User cannot change password" and "Password never
expires" checked, the value I read in userAccountControl is 0x10200. I would
expect it to be 0x10240.
Kind regards,
Jan Nielsen
Nov 18 '05 #5
Hi Jan,

Thanks for your feedback.

Have you used ADSI Edit to view the userAccountControl property?

I think we should first determine if the problem is due to your C# program
or the other problem.

The DirectoryService should will get the same value as you say in ADSI
Edit. So I think you should first test without program:

First view your normal account's userAccountControl property, it should be
512, that is UF_NORMAL_ACCOUNT(0x00200). Then, you may use your DC to
change this account's password setting. Then, you should refer the change
again through ADSI Edit.(Remember to refresh it)

If the value only reflects out the UF_DONT_EXPIRE_PASSWD flag and is the
same result as the program get, it means the problem has nothing to do with
the program, but other setting.

Thank you for your patience and cooperation. Please feel free to feedback.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #6
Hi Jan,

Thanks for your feedback.

Have you used ADSI Edit to view the userAccountControl property?

I think we should first determine if the problem is due to your C# program
or the other problem.

The DirectoryService should will get the same value as you say in ADSI
Edit. So I think you should first test without program:

First view your normal account's userAccountControl property, it should be
512, that is UF_NORMAL_ACCOUNT(0x00200). Then, you may use your DC to
change this account's password setting. Then, you should refer the change
again through ADSI Edit.(Remember to refresh it)

If the value only reflects out the UF_DONT_EXPIRE_PASSWD flag and is the
same result as the program get, it means the problem has nothing to do with
the program, but other setting.

Thank you for your patience and cooperation. Please feel free to feedback.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #7
Hi Jan,

Have you tried my suggestion to use ADSI Edit to get the result? Is the
flag affected?

Please feel free to feedback, I will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #8
Hi Jeffrey,

ADSI Edit reports the same values as my C# program.

A user who has a password that does not expire reports 0x10200.

A normal user reports 0x00200.

No other flags, among the ones I'm interested in, seem to affect this value.

Kind regards,
Jan Nielsen
Nov 18 '05 #9
Hi Jan,

Thanks for your feedback.

Because the ADSI Edit gets the same result as C# program, I think the
problem is not the ADSI, it should be the setting of your Active Directory
of your domain setting.

You may consult this issue in microsoft.public.win2000.active_directory or
microsoft.public.win2000.group_policy to fix it.

Once your setting is correct, I think you should get the correct affected
value. Thanks for your understanding.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Xah Lee | last post by:
Python re module has methods flags and pattern. How to use these exactly? e.g. i tried print patternObj.flags() and the error is some "int object is not callable". ...
7
by: loquak | last post by:
Greets. I wonder which way would be the best for holding some state flags in terms of memory use and efficiency. a) struct FLAGS { bool flag1 : 1; bool flag2 : 1;
13
by: Mark A. Odell | last post by:
I write a lot of drivers and there is inevitably some hardware register or buffer descriptor field called 'flags'. The flags are defined, typically, as bit positions. I was thinking I could get...
3
by: Lekyan | last post by:
I have problem setting the password for an ADAM user using C#. I used the SetPassword code given in the Microsoft page, changed several parameters, but ran into an exception. I wonder if other...
3
by: Ignacio X. Domínguez | last post by:
Hi. I'm using the | operator to use multiple flags in a variable. For example: const int flag1 = 0x00000001; const int flag2 = 0x00000002; const int flag3 = 0x00000004; int Flags = flag2 |...
2
by: Technical Group | last post by:
Friends, Can anybody help me out by sending a piece of C# code showing how to add an active directory user to a particular user group? If the group does not exist, then create it. Thanks in...
1
by: Dwight.Dexter | last post by:
I have an enum variable. Is there some way to cast an int or BitArray and get my enum value? I have to communicate with an old C-style sever so I get an array of bits("0","1"). But I'm using an...
6
by: Jan Nielsen | last post by:
In an aspx web page, I'm trying to read out some attributes regarding password settings like UF_PASSWD_NOTREQD, UF_PASSWD_CANT_CHANGE, UF_DONT_EXPIRE_PASSWD and UF_PASSWORD_EXPIRED. According to...
0
by: aloneplayer | last post by:
Hi, All, I wrote a function to share a folder to individual user account with WMI. When I call it : ShareFolder("c:\\test", "Test", "Shared by Riven", 8, Environment.MachineName,...
1
by: bryonb | last post by:
I'm calling win32netcon.NetUserAdd() to create a user to run a service. However, when I try and start the service I get an error. According to the event log the user account is expired. I'm...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.