If I use the path:
WintNT://MyComputer/BUILTIN/Administrators I get an
exception with I try and Invoke IsMember. Without the
BUILTIN, no
exception, it just always fails.
Thanks,
-Mont
On 9/10/06, Booth, Bill <BBooth panamericanlife.com>
wrote:
>
> Have you tried BUILTIN/Adminstrators?
>
> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
> language [mailto OTNET-CL
R DISCUSS.DEVELOP.COM] On Behalf Of Mont
> Rothstein
> Sent: Saturday, September 09, 2006 6:10 PM
> To: DOTNET-CLR DISCUSS.DEVELOP.COM
> Subject: [DOTNET-CLR] Can't determine group membership
for local machine
>
>
> I am trying to determine is a user is a member of the
Administrators
> group (so I know whether to add them or not), but I
can't seem to get it
> working.
>
> I'm using the following code:
>
> DirectoryEntry group;
>
> group = new
DirectoryEntry("WinNT://" +
> Environment.MachineName+ "/" +
"Administrators");
> bool retVal =
(bool)group.Invoke("IsMember", new object[] {
> "WinNT://" + Environment.MachineName +
"/" + userName });
>
> retVal is always false. I've tested for every user in
the group.
>
> I am a local administrator. Might I not have some
permission that I
> need?
>
> Thanks,
> -Mont
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentorŪ http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|