Sunday, November 13, 2005


WindowsIdentity.Groups can be used to display the list of groups that an account belongs to. The following code enumerates the group list and displays both the group name and SID.

WindowsIdentity wi = WindowsIdentity.GetCurrent();
foreach (IdentityReference id in wi.Groups)
Console.WriteLine(@" {0}, {1}",

However, this property is buggy. So be cautious to use it. I found strange (wrong) behaves.

  1. If you list the groups that Network Service or Local Service belongs to, you get two Users groups with the same SID.
  2. If you create a local normal user named tmpUser and then remove it from the Users group, then you log out and relog in your system, and then launch your app under the tmpUser account to display the list of groups that it belongs to. You'll find that the Users group still shows up in the list!


At 2:21 AM, Anonymous Anonymous said...

Good day! Would you mind if I share your blog with my twitter group?
There's a lot of people that I think would really appreciate your content. Please let me know. Thank you

My blog post ...

At 9:57 PM, Anonymous Anonymous said...

Spot on with this write-up, I really believe that this amazing site needs far more attention.
I'll probably be returning to read more, thanks for the advice!

Also visit my website ... vakantiehuisjes frankrijk

At 3:45 PM, Anonymous Anonymous said...

Very nice post. I just stumbled upon your blog and wanted to say that I have
really enjoyed browsing your blog posts. In any case I will be subscribing to your rss feed and I
hope you write again very soon!

my webpage - francesca battistelli this is the stuff

At 10:30 AM, Anonymous Anonymous said...

If you are going for finest contents like me, only pay a visit this site
every day since it presents quality contents, thanks

My blog post ... luxe vakantiehuizen []

At 8:53 AM, Anonymous Anonymous said...

electronic cigarette starter kit, smokeless cigarettes, ecigarette, e cigarette, electronic cigarette, electronic cigarette


Post a Comment

<< Home