
AppDomain domain = System.Threading.Thread.GetDomain();
domain.SetPrincipalPolicy(System.Security.Principal.PrincipalPolicy.WindowsPrincipal);
System.Security.Principal.WindowsPrincipal principal = (System.Security.Principal.WindowsPrincipal)System.Threading.Thread.CurrentPrincipal;
if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.User))
{
string s = "您的电脑系统权限为:普通用户";
label6.Text = s;
}
if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.PowerUser))
{
string s = "您的电脑系统权限为:超级用户";
label6.Text = s;
}
if (principal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator))
{
string s = "您的电脑系统权限为:系统管理员";
label6.Text = s;
}