Adding users, or most often groups from Active Directory to the local administrator group on the server or client is a common task carried out as a system administrator.
Previously, accomplishing this required some scripting, but now it’s possible to use a simple one-liner. Of course, you can also use this one-liner in your scripts.
How to add users or groups from Active Directory to the local admin group
As mentioned in the introduction, previously, you were required to create a custom script for adding users or groups to the local admin group using Powershell.
Open an elevated Powershell window and enter the following command, updated with your scenario:
Add-LocalGroupMember -Group "Administrators" -Member "domain\user or group", "additional users or groups"
That’s it! When I look in the local administrator group from the Computer Management view, I now see my domain user:
Carrying out simple tasks as adding users or groups to the local administrator group can be done via the GUI or Powershell.
How do you add users or groups to the local administrator group? Please leave a comment below!
- Use Powershell to copy content from one text file to another
- Elevate Powershell window to administrator
- Copy a file to a new directory using Powershell
- Powershell script to add users from a file to a group
- How to change the Powershell version for backward compatibility
- Powershell UNC path browsing using PSDrives