日期:2014-05-17 浏览次数:20910 次
''' <summary>
''' 当前是否是管理员身份运行
''' </summary>
''' <returns></returns>
Public Shared Function IsAdministrator() As Boolean
Try
Dim identity As WindowsIdentity = WindowsIdentity.GetCurrent()
Dim principal As New WindowsPrincipal(identity)
Return principal.IsInRole(WindowsBuiltInRole.Administrator)
Catch
Return True
End Try
End Function