Wednesday, 15 February 2017

Check Admin Or Not VB.NET + Source Code

Check Admin Or Not VB.NET + Source Code

Program :


Dim user As System.Security.Principal.IIdentity = System.Security.Principal.WindowsIdentity.GetCurrent()

        Dim principal As New System.Security.Principal.WindowsPrincipal(CType(user, System.Security.Principal.WindowsIdentity))

        If principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator) Then
            MsgBox("Admin Account", MsgBoxStyle.Information)
        Else
            MsgBox("Normal Account", MsgBoxStyle.Information)
        End If

No comments:

Post a Comment