Possible Duplicate:
How to get the groups of a user in Active Directory? (c#, asp.net)
Is there a way get the currently logged on user using the System.DirectoryServices.AccountManagement
namespace? I've been using the following:
Dim wi As System.Security.Principal.WindowsIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()
Dim fullName As String = wi.Name.ToString
Dim loggedOnUser = fullName.Substring(fullName.IndexOf("\") + 1)
Console.WriteLine("The currently logged on user is {0}", loggedOnUser)
But I want more information about the current user, like the group names they belong to in plain text, and was wondering if the AccountManagement
namespace provides this.
Using this just returns strings of numbers that I can't make sense of:
For Each item As IdentityReference In wi.Groups
Console.WriteLine(item.ToString())
Next