reading userAccountControl flags
Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance
Hi!
I'm trying to determine if an AD user has the "Password never expires" flag
set. I've only been able to find some vb script examples that show how to do
this but I haven't been able to translate this to C#.
I've tried this:
if ((dirEntry.Properties["userAccountControl"].Value &&
UF_DONT_EXPIRE_PASSWD) == 0)
but that results in an error: Operator '&&' cannot be applied to operands of
type 'object' and 'int'
Can someone help with this?
Thanks in advance
Morten
.
Relevant Pages
- Re: changing existing local user flag "never expires"
... set the flag "password never expires". ... A non-zero result means that the flag is ... which means that the script results in the flag not being ... If (lngFlags And ADS_UF_DONT_EXPIRE_PASSWD) = 0 Then ... (microsoft.public.scripting.vbscript) - Re: newbie question: how to convert str to int in c-shell?
... If you want to write a script, don't use csh. ... if it is not a int, some flag or message should be got. ... (comp.unix.shell) - Re: newbie question: how to convert str to int in c-shell?
... If you want to write a script, ... if it is not a int, some flag or message should be got. ... Shell Scripting Recipes: ... (comp.unix.shell) - Re: Password never expires-cant force user to change password
... I'm just not a very good script writer and am not very confident. ... > password policy other than the fact that instead of thinking that UserA has ... > 90 days until their password expires, after you run the script UserA's ... >> expiration dates are staggered by department. ... (microsoft.public.windows.server.active_directory) - Re: instituting ad password policy
... Either script this or do it manually. ... ' Use ADO to search Active Directory. ... ' Filter on user objects that have password never expires flag set. ... ' Comma delimited list of attribute values to retrieve. ... (microsoft.public.windows.server.active_directory) |
|