Powershell 如何查找:是否为域管理员?

Powershell 如何查找:是否为域管理员?,powershell,Powershell,我有一个帐户,例如(MyDomain\User1),它只能访问安装了Windows Server 2008 R2的虚拟机,其他什么都没有 我根本无法访问Active Directory(AD)或Dmain控制器(DC) 如何判断此特定帐户(MyDomain\User1)是否为域管理员?是否有任何Windows PowerShell命令用于此 谢谢你 简单,只需检查当前用户是否是域管理员组的成员 $CurrentUser = [System.Security.Principal.WindowsId

我有一个帐户,例如(MyDomain\User1),它只能访问安装了Windows Server 2008 R2的虚拟机,其他什么都没有

我根本无法访问Active Directory(AD)或Dmain控制器(DC)

如何判断此特定帐户(MyDomain\User1)是否为域管理员?是否有任何Windows PowerShell命令用于此


谢谢你

简单,只需检查当前用户是否是域管理员组的成员

$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."
}

域管理员列表保存在域中。如果您无法访问该域,如何使用该域中保存的访问信息?安全屏障的全部意义在于成为屏障。