How to find out: is the domain administrator or not?

I have an account, for example. (MyDomain \ User1), which has ONLY access to the virtual machine with Windows Server 2008 R2 installed and nothing else.

I have no access to Active Directory (AD) or Dmain Controller (DC) at all.

How do I know if this account (MyDomain \ User1) is a domain administrator or not? Is there a Windows PowerShell command for this?

Thanks you!

+3


source to share


1 answer


Simple, just check the current user for membership in the domain admins group.



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

      

+6


source







All Articles