I am asking the same question as this post "Detect if another process is started as “Run as Administrator”"
I tried converting the code to Visual Basic myself, but I am getting a lot of errors. As far as code, this is what I have so far:
    Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Imports System.Security.Principal
Imports System.Reflection
Namespace WindowsFormsApplication2
    Public Class ProcessHelper
        <DllImport("advapi32.dll", SetLastError:=True)>
        Private Shared Function OpenProcessToken(ByVal ProcessHandle As IntPtr, ByVal DesiredAccess As UInt32, <Out> ByRef TokenHandle As IntPtr) As Boolean
        <DllImport("kernel32.dll", SetLastError:=True)>
        Private Shared Function CloseHandle(ByVal hObject As IntPtr) As Boolean
        Private Const STANDARD_RIGHTS_REQUIRED As Integer = &HF0000
        Private Const TOKEN_ASSIGN_PRIMARY As Integer = &H1
        Private Const TOKEN_DUPLICATE As Integer = &H2
        Private Const TOKEN_IMPERSONATE As Integer = &H4
        Private Const TOKEN_QUERY As Integer = &H8
        Private Const TOKEN_QUERY_SOURCE As Integer = &H10
        Private Const TOKEN_ADJUST_GROUPS As Integer = &H40
        Private Const TOKEN_ADJUST_PRIVILEGES As Integer = &H20
        Private Const TOKEN_ADJUST_SESSIONID As Integer = &H100
        Private Const TOKEN_ADJUST_DEFAULT As Integer = &H80
        Private Const TOKEN_ALL_ACCESS As Integer = (STANDARD_RIGHTS_REQUIRED Or TOKEN_ASSIGN_PRIMARY Or TOKEN_DUPLICATE Or TOKEN_IMPERSONATE Or TOKEN_QUERY Or TOKEN_QUERY_SOURCE Or TOKEN_ADJUST_PRIVILEGES Or TOKEN_ADJUST_GROUPS Or TOKEN_ADJUST_SESSIONID Or TOKEN_ADJUST_DEFAULT)
        Public Shared Function IsProcessOwnerAdmin(ByVal processName As String) As Boolean
            Dim proc As Process = Process.GetProcessesByName(processName)(0)
            Dim ph As IntPtr = IntPtr.Zero
            OpenProcessToken(proc.Handle, TOKEN_ALL_ACCESS, ph)
            Dim iden As WindowsIdentity = New WindowsIdentity(ph)
            Dim result As Boolean = False
            For Each role As IdentityReference In iden.Groups
                If role.IsValidTargetType(GetType(SecurityIdentifier)) Then
                    Dim sid As SecurityIdentifier = TryCast(role, SecurityIdentifier)
                    If sid.IsWellKnown(WellKnownSidType.AccountAdministratorSid) OrElse sid.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid) Then
                        result = True
                        Exit For
                    End If
                End If
            Next
            CloseHandle(ph)
            Return result
        End Function
    End Class
    Module Program
        <STAThread>
        Private Sub Main()
            Dim isAdmin As Boolean = ProcessHelper.IsProcessOwnerAdmin("outlook")
        End Sub
    End Module
End Namespace
Any idea on what I may be doing wrong here? I am trying to check to see if other processes are administrative level or not. I did research to see if there were any other vb.net threads for this on here. Plus- I did some simple google searching and couldn't find anything that wasn't in C#.
Most of my errors have to do with the dll importing and the private functions following those.
Thanks you guys in advanced!
^^^EDITTTTT 7:06 PM So I applied "RobertBaron"'s code and this is the error that I receive? Was unable to find any threads related to this error.
Error relating to edittt 7:06 PM
^^^EDITTTTT 7:15 PM
Sorry, I was able to find the answer to my edit. I found the answer here: "https://learn.microsoft.com/en-us/dotnet/visual-basic/misc/bc31529" and the functions now look like this.
 <DllImport("advapi32.dll", SetLastError:=True)>
    Private Shared Function OpenProcessToken(ByVal ProcessHandle As IntPtr, ByVal DesiredAccess As Integer, ByRef TokenHandle As IntPtr) As Boolean
    End Function
    <DllImport("kernel32.dll", SetLastError:=True)>
    Public Shared Function CloseHandle(ByVal hObject As IntPtr) As <MarshalAs(UnmanagedType.Bool)> Boolean
    End Function
 
    