在Windows 7上检查用户是否为管理员 [英] Check User is Admin or Not on Windows 7

查看:116
本文介绍了在Windows 7上检查用户是否为管理员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

如何确保当前用户是管理员或具有管理员权限来运行应用程序.有什么可能性可以证明这种情况.
需要建议.
谢谢

问候,
Itz.Irshad

Hi Guys,

How it can be make sure that current user is administrator or having rights of administrator to run application. What are possibilities to testify that scenario.
Suggestions are required.
Thanks

Regards,
Itz.Irshad

推荐答案

类似的东西.

Something similar like this.

method here
{ 
   WindowsIdentity identity = WindowsIdentity.GetCurrent();
     
   WindowsPrincipal user = new WindowsPrincipal(identity);

   string role = "BUILTIN\\Administrators";
   bool IsAdmin = user.IsInRole(role));
}


这篇关于在Windows 7上检查用户是否为管理员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆