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

Posted on 2019-03-20 21:33  努力成长静待花开  阅读(774)  评论(0编辑  收藏  举报

 

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

拓展    之前文章