I am trying to figure out how to determine if a program is running admin mode. I have shown some example coding on what I am using below in .NET:
Imports System.Security.Principal
Module Module1
Sub Main()
Dim id = WindowsIdentity.GetCurrent()
Dim pr = New WindowsPrincipal(id)
Dim isAdm As Boolean = pr.IsInRole(WindowsBuiltInRole.Administrator)
If isAdm = True Then
MessageBox.Show(Me, "Running Admin")
else
MessageBox.Show(Me, "Not Running Admin")
End If
End Sub
End Module
This works great for the most case but I have a user who is running Windows 7 Professional and it is returning TRUE no matter what if he ran as admin or not.
I don't know what would cause this, but is there a way to figure out why this is happening, and possibly a solution. Either to figure out that the program will always return true regardless through coding, or maybe a solution to the coding for this issue.
Any clues?