This one is "inspired" from http://www.oreillynet.com/windows/bl...groups_of.html

c# Code:
  1. using System;
  2. using System.Linq;
  3. using System.Security.Principal;
  4. using System.Collections.Generic;
  5.  
  6. namespace CheckWindowsSecurityGroup
  7. {
  8.     class FindGroups
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             var myGroups = GetWindowGroupsFromToken();
  13.             foreach (var myGroup in myGroups)
  14.             {
  15.                 Console.WriteLine(myGroup);
  16.             }
  17.         }
  18.         private static IEnumerable<string> GetWindowGroupsFromToken()
  19.         {
  20.            
  21.             var id = WindowsIdentity.GetCurrent();
  22.             if (id == null)
  23.             {
  24.                 return null;
  25.             }
  26.             else
  27.             {
  28.                 if (id.Groups != null)
  29.                 {
  30.                     var irc = id.Groups.Translate(typeof (NTAccount));
  31.  
  32.                     return (from NTAccount acc in irc select acc.Value.ToUpper()).ToList();
  33.                 }
  34.             }
  35.         }
  36.  
  37.  
  38.     }
  39. }