我有一个帐户,例如(MyDomain\User1),它只能访问安装了Windows Server2008 R2的虚拟机,没有其他权限。
我根本无法访问Active Directory (AD)或Dmain控制器(DC)。
如何判断此特定帐户(MyDomain\User1)是否是域管理员?有什么Windows PowerShell命令可以做到这一点吗?
谢谢你!
发布于 2014-08-03 17:25:21
很简单,只需检查当前用户在域管理员组中的成员身份。
$CurrentUser = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$WindowsPrincipal = New-Object System.Security.Principal.WindowsPrincipal($CurrentUser)
if($WindowsPrincipal.IsInRole("Domain Admins"))
{
Write-Host "Currently running as a Domain Admin"
}
else
{
Write-Host "Keep dreaming, you're not a Domain Admin."
}https://stackoverflow.com/questions/25103147
复制相似问题