Cmdlets

Choose a cmdlet from the list on the left or search for a specific cmdlet. Choose a cmdlet from the list or search for a specific cmdlet.
About Help  Providers
 

Test-UserGroupMembership

Test-UserGroupMembership

pscx.dll

Synopsis

PSCX Cmdlet: Tests whether or not a user (current user by default) is a member of the specified group name.

Syntax

Test-UserGroupMembership [-GroupName] [-Identity] [<CommonParameters>]

Test-UserGroupMembership [-IdentityReference] [-Identity] [<CommonParameters>]

Detailed Description

Tests whether or not a user (current user by default) is a member of the specified group name. This can be used to test whether a user is admin or elevated to admin.

Parameters

-GroupName <String[]>

Name of the group to test membership of. Examples: Administrators, Users, Power Users, etc

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-IdentityReference <IdentityReference[]>

Reference to the identity to act upon.

Aliases

None

Required?

true

Position

1

Default value

None

Accept pipeline input?

false

Accept wildcard characters?

false

-Identity <WindowsIdentity>

The identity to act upon.

Aliases

None

Required?

false

Position

2

Default value

None

Accept pipeline input?

true (ByValue)

Accept wildcard characters?

false

Input Type


Return Type

Boolean

Notes

Examples

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

Tests to see if the current user is a member of the Administrators group.

PS> Test-UserGroupMembership -GroupName Administrators
False