< Back

Test-IsDomainAdmin

Fri Jan 10, 2020 7:10 pm

NAME Test-IsDomainAdmin



SYNOPSIS

Tests if a user is a member of the Domain Admins group.





SYNTAX

Test-IsDomainAdmin [[-UserName] <String>] [[-Domain] <String>] [<CommonParameters>]



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





DESCRIPTION

The Test-IsDomainAdmin returns true if the user is in the Domain Admins group and false otherwise.





PARAMETERS

-UserName <String>

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

WindowsIdentity Principal.



Required? false

Position? 1

Default value [System.String]::Empty

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Credential <PSCredential>

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

execute commands.



Required? false

Position? 1

Default value [PSCredential]::Empty

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Domain <String>

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



Required? false

Position? 2

Default value

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-IsDomainAdmin



Determines if the user credentials being used to run the cmdlet has Domain Admin privileges.









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



PS C:\\>Test-IsDomainAdmin -UserName "John Smith"



Determines if the user John Smith has Domain Admin privileges











RELATED LINKS