Freigeben über


PowerTip: Add Computer to Security Group with PowerShell

Summary: Use Active Directory PoweShell cmdlets to add a computer to a security group.

Hey, Scripting Guy! Question How can I use Windows PowerShell to add a computer to a security group?

Hey, Scripting Guy! Answer Use the Add-ADGroupMember cmdlet, and remember to use the SAM account name on the computer:

To add a computer called “STATION01” to a security group called “RDPEnabled”:

ADD-ADGroupMember “RDPEnabled” –members “STATION01$”

Note  The SAM account name has a “ $ ” added to its name.