Is there a simple way to determine if the user running a vb program logged in to windows with administrator rights?
The stuff I found on msdn seems very complex.
Update:
All I really care about is the user name. It does not have to be high security.
I found this function however I dont think it works in 2002. Anyone know an equivalent?
Code:Function GetUserName() As String If TypeOf My.User.CurrentPrincipal Is _ Security.Principal.WindowsPrincipal Then ' The application is using Windows authentication. ' The name format is DOMAIN\USERNAME. Dim parts() As String = Split(My.User.Name, "\") Dim username As String = parts(1) Return username Else ' The application is using custom authentication. Return My.User.Name End If End Function




Reply With Quote