[[powershell-commands-add-admin]]

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.

$Password = Read-Host -AsSecureString
New-LocalUser "user_name" -Password $Password
Add-LocalGroupMember -Group "Administrators" -Member "user_name"

Be sure to replace “user_name” with the actual values in lines 2 & 3.

  • powershell-commands-add-admin.txt
  • Last modified: 2025/04/17 18:30
  • by jsanders