判断用户是否为管理员权限

##查看标题
$host.ui.RawUI.WindowTitle
##试探权限
Enable-PSRemoting -Force
##返回Boolean值
([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole("administrator")

拓展    之前文章

猜你喜欢

转载自www.cnblogs.com/feiyucha/p/10567875.html