[[powershell-commands-add-to-admin-group]]

This is an old revision of the document!


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.

# 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
  • powershell-commands-add-to-admin-group.1758563690.txt.gz
  • Last modified: 2025/09/22 17:54
  • by jsanders