List Info

Thread: Can't determine group membership for local machine




Can't determine group membership for local machine
user name
2006-09-10 14:53:59
Have you tried BUILTIN/Adminstrators?

-----Original Message-----
From: Discussion of development on the .NET platform using
any managed
language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Mont
Rothstein
Sent: Saturday, September 09, 2006 6:10 PM
To: DOTNET-CLRDISCUSS.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Ū  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Can't determine group membership for local machine
user name
2006-09-10 16:59:03
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 <BBoothpanamericanlife.com>
wrote:
>
> Have you tried BUILTIN/Adminstrators?
>
> -----Original Message-----
> From: Discussion of development on the .NET platform
using any managed
> language [mailtoOTNET-CL
RDISCUSS.DEVELOP.COM] On Behalf Of Mont
> Rothstein
> Sent: Saturday, September 09, 2006 6:10 PM
> To: DOTNET-CLRDISCUSS.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

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )