Hi All,
Quick question, I manage to come up with a working code the
successfully checks if the current users is part of the Administrators
group or not. My question is, will this code work from Windows 95? 98?
ME? 2000?
My development machine is currently XP, and it works fine here.
Thanks in advance,
Henry :)
Private Function CheckAdministratorRole() As Boolean
On Error Resume Next
System.AppDomain.CurrentDomain.SetPrincipalPolicy( Security.Principal.PrincipalPolicy.WindowsPrincipa l)
Dim prpAdministrator As New
System.Security.Permissions.PrincipalPermission(En vironment.UserName,
"BUILTIN\Administrators")
prpAdministrator.Demand()
If Err.Number <> 0 Then
CheckAdministratorRole = True
Else
CheckAdministratorRole = False
End If
End Function