If you want to add or remove Local and Microsoft accounts to the Administrators group in Windows 11 or Windows 10, you can do so with the help of Windows PowerShell. Here is the detailed guide you need to follow in order to get it done.
There are multiple user account groups available in Windows 11 and Windows 10. For that, you can find Administrators, Backup Operators, Event Log Readers, Device Owners, Replicators, Power Users, Users, etc. Out of all those types, the Administrators group holds the highest position on your computer. If a user account is associated with that particular group, the corresponding user doesn’t require any other administrators privileges to install an app or change a setting.
When you create a user account in Windows 11/10, you might not create an administrator account all the time. If you created an account earlier and wanted to add it to the Administrators group now, you can use this guide to get the job done. As Windows PowerShell is involved for this purpose, you do not need to go through any complicated setting or option.
Add or Remove Local & Microsoft accounts to Administrators Group using PowerShell
First, you need to open Windows PowerShell with administrator privileges. However, in this case, we are going to use the Windows PowerShell instance in Windows Terminal. For that, you need to open the Windows Terminal with administrator permissions.
To do that, press Win+X to open the menu, select Windows Terminal (Admin) and click the Yes option.
Then, enter the following command to add a new user account to the Administrators group:
Add-LocalGroupMember -Group "Administrators" -Member "username"
However, you must replace the username with the original username of the user account.
If it is a Microsoft account, you need to enter this command:
Add-LocalGroupMember -Group "Administrators" -Member "MicrosoftAccount\[email protected]"
On the other hand, if you want to remove a user from the Administrators group, you need to use the remove parameter. For example, if you have a user called abcd, you must enter this command:
Remove-LocalGroupMember -Group "Administrators" -Member "abcd"
In case you want to add an Azure Active Directory account to the Administrators group, enter this command:
Add-LocalGroupMember -Group "Administrators" -Member "AzureAD\[email protected]"
However, if you want to add an Active Directory account to the Administrators groups using Windows PowerShell, the following command will do the job:
Add-LocalGroupMember -Group "Administrators" -Member "domain\user"
Which PowerShell command will add a local user to a local group?
You can use Add-LocalGroupMember cmdlet to add local users to a local group. This cmdlet is quite handy and is used for different purposes on Windows 11/10 computers. Whether you want to apply it on a local computer or a remote computer, both are possible to do. Similarly, you can use the remove parameter to remove a user account from the local group.
How do I add a user to a group in PowerShell?
To add a user to a group in PowerShell on Windows 11/10, you need to use this cmdlet: Add-LocalGroupMember. Whether you want to assign an account to the Local or Administrators group, you can do both using the same cmdlet. On the other hand, Remove-LocalGroupMember cmdlet helps you remove an account from the chosen group on Windows 11/10. For your information, it is possible to use these commands on host and Remote computers.
That’s all! Hope it helped.
Read: How to manage Local Users and Groups using Windows PowerShell.