How To Add The User To The Local Administrators Group Using ...

  • Home
  • Whiteboard
  • Online Compilers
  • Practice
  • Articles
  • AI Assistant
  • Jobs
  • Tools
  • Corporate Training
  • Courses
  • Certifications
Menu Categories Login
  • Switch theme
  • SQL
  • HTML
  • CSS
  • Javascript
  • Python
  • Java
  • C
  • C++
  • PHP
  • Scala
  • C#
  • Tailwind CSS
  • Node.js
  • MySQL
  • MongoDB
  • PL/SQL
  • Swift
  • Bootstrap
  • R
  • Machine Learning
  • Blockchain
  • Angular
  • React Native
  • Computer Fundamentals
  • Compiler Design
  • Operating System
  • Data Structure and Algorithms
  • Computer Network
  • DBMS
  • Excel
Technical Questions and Answers
  • Data Structure Data Structure
  • Networking Networking
  • RDBMS RDBMS
  • Operating System Operating System
  • Java Java
  • MS Excel MS Excel
  • iOS iOS
  • HTML HTML
  • CSS CSS
  • Android Android
  • Python Python
  • C Programming C Programming
  • C++ C++
  • C# C#
  • MongoDB MongoDB
  • MySQL MySQL
  • Javascript Javascript
  • PHP PHP
  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary
  • Who is Who
How to add the user to the local Administrators group using PowerShell? PowerShellMicrosoft TechnologiesSoftware & Coding

To add the AD user or the local user to the local Administrators group using PowerShell, we need to use the Add-LocalGroupMember command.

To add the local user to the local Administrators group,

Add-LocalGroupMember -Group Administrators -Member TestUser -Verbose

The above command will add TestUser to the local Administrators group. You can provide any local group name there and any local user name instead of TestUser

You can also add the Active Directory domain user to the Local Administrators group by providing the domain name if the computer is in the same domain.

For example, we will add the Beta user from the AutomationLab domain as shown below.

Add-LocalGroupMember -Group Administrators -Member AutomationLab\Beta

You can provide the multiple members separated by comma (,) but only one local group is supported.

Add-LocalGroupMember -Group Administrators -Member TestUser, Testuser2 -Verbose

To add the local user or the AD user to the remote computer, use Invoke-Command.

Invoke-Command -ComputerName Computer1, Computer2 -ScriptBlock{ Add-LocalGroupMember -Group Administrators -Member TestUser1, TestUser2 } Chirag Nagrekar Chirag Nagrekar Updated on: 2023-11-04T01:25:40+05:30

44K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started Print Page Previous Next Advertisements

Tag » Add Computer To Local Administrator Group Powershell