PowerShell Logo Small

Remove-ADPrincipalGroupMembership



This is the built-in help made by Microsoft for the command 'Remove-ADPrincipalGroupMembership', in PowerShell version 3 - as retrieved from Windows version 'Microsoft Windows Server 2012 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Removes a member from one or more Active Directory groups.

SYNTAX


Remove-ADPrincipalGroupMembership [-Identity] <ADPrincipal> [-MemberOf] <ADGroup[]> [-AuthType <ADAuthType>] [-Credential <PSCredential>]
[-Partition <String>] [-PassThru [<SwitchParameter>]] [-Server <String>] [-Confirm [<SwitchParameter>]] [-WhatIf [<SwitchParameter>]]
[<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Remove-ADPrincipalGroupMembership cmdlet removes a user, group, computer, service account, or any other account object from one or more
Active Directory groups.


The Identity parameter specifies the user, group, or computer to remove. You can identify the user, group, or computer by its distinguished
name (DN), GUID, security identifier (SID) or SAM account name. You can also specify a user, group, or computer object variable, such as
$<localGroupObject>, or pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADUser cmdlet to
retrieve a user object and then pass the object through the pipeline to the Remove-ADPrincipalGroupMembership cmdlet. Similarly, you can use
Get-ADGroup or Get-ADComputer to get group, service account and computer objects to pass through the pipeline.


This cmdlet collects all of the user, computer, service account and group objects from the pipeline, and then removes these objects from the
specified group by using one Active Directory operation.


The MemberOf parameter specifies the groups that you want to remove the member from. You can identify a group by its distinguished name (DN),
GUID, security identifier (SID) or Security Accounts Manager (SAM) account name. You can also specify group object variable, such as
$<localGroupObject>. To specify more than one group, use a comma-separated list. You cannot pass group objects through the pipeline to the
MemberOf parameter. To remove a member from groups that are passed through the pipeline, use the Remove-ADGroupMember cmdlet.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/?LinkID=219337
Add-ADGroupMember
Add-ADPrincipalGroupMembership
Get-ADComputer
Get-ADGroup
Get-ADGroupMember
Get-ADPrincipalGroupMembership
Get-ADServiceAccount
Get-ADUser
Remove-ADGroupMember

REMARKS

<

Examples


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

C:\PS>Remove-ADPrincipalGroupMembership -Identity "Wilson Pais" -MemberOf "Administrators"

Remove members from group
Do you want to remove all the specified member(s) from the specified group(s)?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): Y



Description

-----------

Remove the user 'Wilson Pais' from the administrators group.




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

C:\PS>get-aduser -server localhost:60000 -Identity "CN=GlenJohns,DC=AppNC" | remove-adprincipalgroupmembership -memberof
"CN=AccessControl,DC=AppNC"



Description

-----------

Retrieve the user with DistinguishedName 'CN=GlenJohns,DC=AppNC' and remove it from the group with the DistinguishedName
'CN=AccessControl,DC=AppNC' using the pipeline.