Imports System.DirectoryServices
Imports System.DirectoryServices.AccountManagement
Private ctx As PrincipalContext = New PrincipalContext(ContextType.Domain)
Private usr As UserPrincipal
Private HRgrp As GroupPrincipal = GroupPrincipal.FindByIdentity(ctx, "*Human Resources")
Dim username As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name 'gets the IIS name
Dim username As String = My.User.Name
|