Adding or Removing a Computer Account from a Group
Updated: February 28, 2009
Applies To: Windows Server 2008 R2
This topic explains how to use the Active Directory module for Windows PowerShell to add or remove a computer account to and from a group.
The following example demonstrates how to add a computer to a group:
Get-ADComputer fabrikamsrv1 | Add-ADPrincipalGroupMembership -MemberOf ManagedComputerGroups
To add multiple computers to a group, you can pipeline (pass additional values for) multiple computer accounts to the Add-ADPrincipalGroupMembership cmdlet by using the Get-ADComputer cmdlet.
The following example demonstrates how to remove a computer from a group:
Remove-ADGroupMember -Identity SvcAccPSOGroup -Member IIS01
For a full explanation of the parameters that you can pass to Get-ADComputer, Add-ADPrincipalGroupMembership, or Remove-ADGroupMember, at the Active Directory module command prompt, type Get-Help Get-ADComputer –detailed, Get-Help Add-ADPrincipalGroupMembership –detailed, or Get-Help Remove-ADGroupMember –detailed, and then press ENTER.