Adding or Removing a Computer Account from a Group
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.
Example 1
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.
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.
Example 2
The following example demonstrates how to remove a computer from a group:
Remove-ADGroupMember -Identity SvcAccPSOGroup -Member IIS01
Remove-ADGroupMember -Identity SvcAccPSOGroup -Member IIS01
Additional information
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.
No comments:
Post a Comment