December 25th, 2013

PowerTip: Add Computer to Security Group with PowerShell

Doctor Scripto
Scripter

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.

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.