Add a member to a local group on Windows
Add users, groups or computers to a local security group with Add-LocalGroupMember — scriptable group management beyond net localgroup.
01Command
$ Add-LocalGroupMember -Group "Remote Desktop Users" -Member "CONTOSO\jane"02What it does
Compared to net localgroup, this cmdlet resolves the account against the machine, domain and Entra ID in one step and fails loudly if the principal does not exist. -Member accepts several principals in one call, and the exact inverse Remove-LocalGroupMember gives scripts a symmetric grant/revoke pair. Adding to Administrators works but any privileged change should be logged and reviewed.
03Risk
04Undo
$ Remove-LocalGroupMember -Group "Remote Desktop Users" -Member "CONTOSO\jane"05Sources
- Add-LocalGroupMember | Microsoft LearnEvidence: Microsoft documents Add-LocalGroupMember as adding users, groups or computers to a local security group, with Remove-LocalGroupMember as the inverse.
Last verified: 2026-09-17 · Category: Security & Privacy
06Related solutions
Search inside text files and logs with regex, returning file, line number and match.
Create or update a .zip from any files or folder contents straight from PowerShell.
A built-in PowerShell one-liner that answers 'is port 5432/3389/443 actually open through this network?' — no telnet client needed.