< Back

Test-IsEnterpriseOrDomainAdmin

Fri Jan 10, 2020 7:11 pm

NAME Test-IsEnterpriseOrDomainAdmin



SYNOPSIS

Tests whether the current user or provided credential is a Domain Admin or Enterprise Admin.





SYNTAX

Test-IsEnterpriseOrDomainAdmin [[-Username] <String>] [[-Domain] <String>] [<CommonParameters>]



Test-IsEnterpriseOrDomainAdmin [[-Credential] <PSCredential>] [[-Domain] <String>] [<CommonParameters>]





DESCRIPTION

The Test-IsEnterpriseOrDomainAdmin returns true if the user is in the group and false otherwise.





PARAMETERS

-Credential <PSCredential>

The PSCredential to use to test if the user has Enterprise Admin credentials. These credentials are not used

to execute commands.



Required? false

Position? 1

Default value [System.Management.Automation.PSCredential]::Empty

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Username <String>

The user to test the group membership on. If no user name is specified, the cmdlet runs against

WindowsIdentity Principal.



Required? false

Position? 1

Default value [System.String]::Empty

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Domain <String>

The domain to check for privileges in. This defaults to the current user's domain.



Required? false

Position? 2

Default value [System.String]::Empty

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.Management.Automation.PSCredential



System.String





OUTPUTS

System.Boolean





NOTES





AUTHOR: Michael Haken

LAST UPDATE: 1/7/2017



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Test-IsEnterpriseOrDomainAdmin



Determines if the user credentials being used to run the cmdlet have Domain or Enterprise Admin privileges









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Test-IsEnterpriseOrDomainAdmin -Credential $Creds



Determines if the credentials have Enterprise or Domain Admin privileges











RELATED LINKS