This is an old revision of the document!
Add an existing user to Local Administrators group via Powershell
This script will prompt for a new password, store it as a secure string, then provision a new user with that password. It will also add the new user to the Administrators
group.
Command
# Replace with your local user ID or AzureAD/Entra ID - prefix with 'AzureAD\' for latter case $User = "username" Add-LocalGroupMember -Group "Administrators" -Member $User # Alternative script for AzureAD/Entra net localgroup administrators AzureAD\<username> /add