Which domain groups is a user in?

A console application to determine which groups a user is in:

My.User.InitializeWithWindowsUser() Dim identity As System.Security.Principal.WindowsIdentity = TryCast(My.User.CurrentPrincipal.Identity, System.Security.Principal.WindowsIdentity) Debug.WriteLine(identity.Name) For Each group As System.Security.Principal.SecurityIdentifier In identity.Groups() Debug.WriteLine(group.Translate(GetType(System.Security.Principal.NTAccount)), “group”) Next

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

A WordPress.com Website.

Up ↑

%d bloggers like this: