Introduction

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.

In this blog post, I cover how to use the Powershell CMDLet Add-LocalGroupMember to add Active Directory users or groups to the local administrator group.

How to add users or groups from Active Directory to the local admin group

The local administrator group in Computer Management

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"
Add users or groups to the local administrator group using Powershell

That’s it! When I look in the local administrator group from the Computer Management view, I now see my domain user:

Domain user has been added to the local administrator group using Powershell

Conclusion

Carrying out simple tasks as adding users or groups to the local administrator group can be done via the GUI or Powershell.

I highly recommend using Powershell for tasks like these, as it’s essential to be fluent in Powershell.

How do you add users or groups to the local administrator group? Please leave a comment below!

References

Related posts

3 COMMENTS

  1. one of the things that irritates me to no end when i look at scripts online is the lack of documentation in them.
    for folks that are trying to learn it is nice to know what each function or call is doing within the script.
    It’s also nice when you enclose the usage information within the script documentation, ie what version of Ps you are writing to, etc. that way people hunting for code snippets dont have to read 3/4 of the way down the page only t9o find that this is applicable to windows server 2012 that runs powershell 3.0 or higher..

LEAVE A REPLY

Please enter your comment!
Please enter your name here