Skip to main content
ubuntuask.com

Back to all posts

How to Add User to Local Admin Group In Powershell?

Published on
3 min read
How to Add User to Local Admin Group In Powershell? image

Best Tools to Add User to Local Admin Group Using PowerShell to Buy in October 2025

1 Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools

BUY & SAVE
$47.34 $59.99
Save 21%
Learn PowerShell Scripting in a Month of Lunches, Second Edition: Write and organize scripts and tools
2 Learn PowerShell Scripting in a Month of Lunches

Learn PowerShell Scripting in a Month of Lunches

BUY & SAVE
$50.26
Learn PowerShell Scripting in a Month of Lunches
3 Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects

BUY & SAVE
$0.99
Beginner’s Guide to PowerShell Scripting: Automate Windows Administration, Master Active Directory, and Unlock Cloud DevOps with Real-World Scripts and Projects
4 Windows PowerShell in Action

Windows PowerShell in Action

  • NEW IN BOX: ENJOY THE FRESHNESS OF AN UNOPENED PRODUCT!
  • COMPLETE PACKAGE: COMES WITH ALL ESSENTIAL ACCESSORIES INCLUDED.
  • SECURE SHIPPING: SAFELY DELIVERED TO YOUR DOOR, READY TO USE!
BUY & SAVE
$59.99
Windows PowerShell in Action
5 Windows PowerShell 2 For Dummies

Windows PowerShell 2 For Dummies

BUY & SAVE
$21.00 $33.99
Save 38%
Windows PowerShell 2 For Dummies
6 Windows PowerShell Step by Step

Windows PowerShell Step by Step

BUY & SAVE
$48.60 $59.99
Save 19%
Windows PowerShell Step by Step
+
ONE MORE?

To add a user to the local admin group in PowerShell, you can use the following command:

Add-LocalGroupMember -Group "Administrators" -Member "username"

Replace "username" with the name of the user you want to add to the local admin group. This command will add the specified user to the local Administrators group on the computer.

How to add a user to the local admin group with a specific password in Powershell?

To add a user to the local admin group with a specific password in Powershell, follow these steps:

  1. Open Powershell with administrative privileges.
  2. Run the following command to create a new user with the specified password: net user /add Replace with the desired username and with the desired password.
  3. Run the following command to add the user to the local administrators group: net localgroup administrators /add Replace with the username that you created in step 2.
  4. Finally, run the following command to set the password expiration policy to never for the user: Set-LocalUser -Name -PasswordNeverExpires $true Replace with the username that you created in step 2.

After completing these steps, the user will be added to the local administrators group with the specified password and the password expiration policy set to never.

How to add a user to the administrators group in Powershell?

To add a user to the administrators group in PowerShell, follow these steps:

  1. Open PowerShell as an administrator by right-clicking on the start menu and selecting "Windows PowerShell (Admin)".
  2. To add a user to the administrators group, use the following command:

Add-LocalGroupMember -Group "Administrators" -Member "username"

Replace "username" with the username of the user you want to add to the administrators group.

  1. Press Enter to execute the command. You should see a confirmation message that the user has been added to the administrators group.

Note: Make sure you have the necessary permissions to add users to groups on the local machine.

How to add multiple users to the local admin group in Powershell?

To add multiple users to the local admin group in Powershell, you can use the following command:

  1. Open Powershell with administrator privileges.
  2. Use the following command to add multiple users to the local admin group:

$users = "user1", "user2", "user3" foreach ($user in $users) { Add-LocalGroupMember -Group "Administrators" -Member $user }

Replace "user1", "user2", "user3" with the usernames of the users you want to add to the local admin group. This script will loop through each user in the $users array and add them to the "Administrators" group.

  1. Run the script in Powershell and the specified users will be added to the local admin group.

What is the easiest way to add a user to the local admin group using Powershell?

The easiest way to add a user to the local admin group using Powershell is by using the Add-LocalGroupMember cmdlet. Here is an example of how to add a user named "JohnDoe" to the local admin group:

Add-LocalGroupMember -Group "Administrators" -Member "JohnDoe"

You can run this command in Powershell with administrative privileges to add the specified user to the local admin group.