Thursday, February 24, 2011

Viewing a User's Group Membership,Group Membership Removal,Transferring Group Membership to Another User

Viewing a User's Group Membership

This topic explains how to use the Active Directory module for Windows PowerShell to view a user’s group membership.

Example

The following example demonstrates how to view the group membership of the user SaraDavis:
Get-ADPrincipalGroupMembership -Identity SaraDavis

Additional information

For a full explanation of the parameters that you can pass to Get-ADPrincipalGroupMembership, at the Active Directory module command prompt, type Get-Help Get-ADPrincipalGroupMembership –detailed, and then press ENTER.

Group Membership Removal

This topic explains how to use the Active Directory module for Windows PowerShell to remove all group memberships from a user.

Example

The following example demonstrates how to remove all group memberships from the user SaraDavis:
Get-ADPrincipalGroupMembership -Identity SaraDavis | % {Remove-ADPrincipalGroupMembership -Identity SaraDavis -MemberOf $_}

Additional information

For a full explanation of the parameters that you can pass to Get-ADPrincipalGroupMembership or Remove-ADPrincipalGroupMembership, at the Active Directory module command prompt, type Get-Help Get-ADPrincipalGroupMembership –detailed or Get-Help Remove-ADPrincipalGroupMembership –detailed, and then press ENTER.


Transferring Group Membership to Another User

This topic explains how to use the Active Directory module for Windows PowerShell to transfer a user’s group membership to another user.

Example

The following example demonstrates how to transfer the group membership of the user SaraDavis to the user JaneDow:
Get-ADPrincipalGroupMembership -Identity SaraDavis | % {Add-ADPrincipalGroupMembership -Identity JaneDow -MemberOf $_}

Additional information

For a full explanation of the parameters that you can pass to Get-ADPrincipalGroupMembership or Add-ADPrincipalGroupMembership, at the Active Directory module command prompt, type Get-Help Get-ADPrincipalGroupMembership –detailed or Get-Help Add-ADPrincipalGroupMembership –detailed, and then press ENTER.

No comments:

Post a Comment