< Back

Test-IsEnterpriseAdmin

Fri Jan 10, 2020 7:10 pm

NAME Test-IsEnterpriseAdmin



SYNOPSIS

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





SYNTAX

Test-IsEnterpriseAdmin [[-UserName] <String>] [<CommonParameters>]



Test-IsEnterpriseAdmin [[-Credential] <PSCredential>] [<CommonParameters>]





DESCRIPTION

The Test-IsEnterpriseAdmin returns true if the user is in the 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 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



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



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









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



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



Determines if the user John Smith has Enterprise Admin privileges.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Test-IsEnterpriseAdmin -Credential (Get-Credential)



Determines if the entered user credentials have Enterprise Admin privileges.











RELATED LINKS