yeah i think i get it.
will give it a try asap.
again many thanks for your help.
""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
news:GW8xAGFnDHA.2624@cpmsftngxa06.phx.gbl...[color=blue]
>
> Hi Arran,
>
> ~, |, & are the bitwise operators of C# language.
> You can find ADS_UF_ACCOUNTDISABLEa in ADS_USER_FLAG_ENUM:
>[/color]
http://msdn.microsoft.com/library/de...us/netdir/adsi[color=blue]
> /ads_user_flag_enum.asp
> that ADS_UF_ACCOUNTDISABLE= 0x0002;
>
> 0x0002's binary expression is 0000,0000,0000,0010, so ~0x0002 is
> 1111,1111,1111,1101.
> val & ~ADS_UF_ACCOUNTDISABLE equals val&1111,1111,1111,1101 which makes[/color]
all[color=blue]
> the other bits stay the same value as before, only the second bit becomes[/color]
0.[color=blue]
> Then, when invoke CommitChanges(), .Net Framework will check second bit of
> userAccountControl property, and 0 means enable.
>
> Alike, val | ADS_UF_ACCOUNTDISABLE equals valu| 0000,0000,0000,0010 which
> makes all bits stay the same, second bit becomes 1.
> This makes diable the user account.
>
> Hope I explain clear.
> If you still have any unclear, please feel free to tell me.
>
> 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.
>
> --------------------
> | From: "Arran Pearce" <arran.pearce@bacoll.ac.uk>
> | References: <#m2xLdZmDHA.2676@TK2MSFTNGP11.phx.gbl>
> <#HAV#kfmDHA.1772@cpmsftngxa06.phx.gbl>
> <#ipErnlmDHA.988@TK2MSFTNGP10.phx.gbl>
> <7Nh#KWsmDHA.1544@cpmsftngxa06.phx.gbl>
> | Subject: Re: ADSI Account Lockout
> | Date: Sat, 25 Oct 2003 18:14:07 +0100
> | Lines: 145
> | X-Priority: 3
> | X-MSMail-Priority: Normal
> | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | Message-ID: <#Qe43rxmDHA.2772@TK2MSFTNGP10.phx.gbl>
> | Newsgroups: microsoft.public.dotnet.languages.csharp
> | NNTP-Posting-Host: host213-122-67-95.in-addr.btopenworld.com[/color]
213.122.67.95[color=blue]
> | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
> | Xref: cpmsftngxa06.phx.gbl[/color]
microsoft.public.dotnet.languages.csharp:194030[color=blue]
> | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
> |
> | In the example for enable or disable the account it has this:
> |
> | int val = (int) usr.Properties["userAccountControl"].Value;
> | usr.Properties["userAccountControl"].Value = val |[/color]
ADS_UF_ACCOUNTDISABLE;[color=blue]
> |
> | and
> |
> | int val = (int) usr.Properties["userAccountControl"].Value;
> | usr.Properties["userAccountControl"].Value = val &[/color]
~ADS_UF_ACCOUNTDISABLE;[color=blue]
> |
> | What is happening with the "val | ADS_UF_ACCOUNTDISABLE" and "val &
> | ~ADS_UF_ACCOUNTDISABLE"?
> |
> |
> |
> | ""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in message
> | news:7Nh%23KWsmDHA.1544@cpmsftngxa06.phx.gbl...
> | >
> | > Hi Arran,
> | >
> | > If you still have anything unclear, please feel free to tell me.
> | > Have a nice weekand.
> | >
> | > 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.
> | >
> | > --------------------
> | > | From: "Arran Pearce" <arran.pearce@bacoll.ac.uk>
> | > | References: <#m2xLdZmDHA.2676@TK2MSFTNGP11.phx.gbl>
> | > <#HAV#kfmDHA.1772@cpmsftngxa06.phx.gbl>
> | > | Subject: Re: ADSI Account Lockout
> | > | Date: Fri, 24 Oct 2003 19:12:12 +0100
> | > | Lines: 81
> | > | X-Priority: 3
> | > | X-MSMail-Priority: Normal
> | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | > | Message-ID: <#ipErnlmDHA.988@TK2MSFTNGP10.phx.gbl>
> | > | Newsgroups: microsoft.public.dotnet.languages.csharp
> | > | NNTP-Posting-Host: host213-122-88-5.in-addr.btopenworld.com
> 213.122.88.5
> | > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
> | > | Xref: cpmsftngxa06.phx.gbl
> | microsoft.public.dotnet.languages.csharp:193875
> | > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
> | > |
> | > | Thanks for all your help.
> | > |
> | > |
> | > | ""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> wrote in[/color]
message[color=blue]
> | > | news:%23HAV%23kfmDHA.1772@cpmsftngxa06.phx.gbl...
> | > | >
> | > | > Hi Arran,
> | > | >
> | > | > Just as Peter said, you should use the userAccountControl[/color]
property.[color=blue]
> | > | > For Lockout and Disabled acount, you should refer to[/color]
ADS_UF_LOCKOUT[color=blue]
> | and
> | > | > ADS_UF_ACCOUNTDISABLE flag which are defined in ADS_USER_FLAG_ENUM
> | enum.
> | > | > Please refer to ADS_USER_FLAG_ENUM enum at the link below:
> | > | >
> | > |
> | >
> |
>[/color]
http://msdn.microsoft.com/library/de...us/netdir/adsi[color=blue]
> | > | > /ads_user_flag_enum.asp
> | > | >
> | > | > You also can find a small sample of how to enable and disable a[/color]
user[color=blue]
> | > | acount:
> | > | >
> | > |
> | >
> |
>[/color]
http://msdn.microsoft.com/library/de...us/netdir/netd[color=blue]
> | > | > s/enabling_and_disabling_the_user_account.asp
> | > | >
> | > | > If you still have any questions, please feel free to let me know.
> | > | >
> | > | > 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.
> | > | >
> | > | > --------------------
> | > | > | From: "Arran Pearce" <arran.pearce@bacoll.ac.uk>
> | > | > | Subject: ADSI Account Lockout
> | > | > | Date: Thu, 23 Oct 2003 19:58:59 +0100
> | > | > | Lines: 23
> | > | > | X-Priority: 3
> | > | > | X-MSMail-Priority: Normal
> | > | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> | > | > | Message-ID: <#m2xLdZmDHA.2676@TK2MSFTNGP11.phx.gbl>
> | > | > | Newsgroups: microsoft.public.dotnet.languages.csharp
> | > | > | NNTP-Posting-Host: host213-122-124-127.in-addr.btopenworld.com
> | > | > 213.122.124.127
> | > | > | Path:
> cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP11.phx.gbl
> | > | > | Xref: cpmsftngxa06.phx.gbl
> | > | microsoft.public.dotnet.languages.csharp:193614
> | > | > | X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
> | > | > |
> | > | > | Hi,
> | > | > |
> | > | > | I am looking for a way to use System.DirectoryServices to find[/color]
all[color=blue]
> | > users
> | > | > on
> | > | > | a domain whos accounts are either locked out or disabled. I[/color]
have[color=blue]
> | used
> | > | > | ADSIEdit and the mmc schema add-in to try and find properties[/color]
for[color=blue]
> | > these
> | > | > | things but have not had any luck so far. Also i did a search on
> the
> | > | > | Platform SDK doc's. It has examples in VB and C++ but these are
> not
> | > | using
> | > | > | DotNet and dont give any hint to a property that may be used.
> They
> | > seem
> | > | > to
> | > | > | call a method directly on a object, and i am sure that method is
> not
> | > | > | available as part of a DirectoryEntry class.
> | > | > |
> | > | > | I have a feeling i may need to do a Invoke (as you do when you
> reset
> | a
> | > | > users
> | > | > | password from DotNet) if i do have to do this then how can i do[/color]
a[color=blue]
> | > | search
> | > | > of
> | > | > | all users in a domain?
> | > | > |
> | > | > | I would also like to be able to Enable or Disable a account from
> my
> | > | > | application (This is Account Lockout and Account Disabled).
> | > | > |
> | > | > | thanks for any help anyone can offer.
> | > | > |
> | > | > | Arran
> | > | > |
> | > | > |
> | > | > |
> | > | >
> | > |
> | > |
> | > |
> | >
> |
> |
> |
>[/color]