[[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.

$NewUser = Read-Host
$Password = Read-Host -AsSecureString
New-LocalUser $NewUser -Password $Password
Add-LocalGroupMember -Group "Administrators" -Member $NewUser
  • powershell-commands-add-admin.txt
  • Last modified: 2025/05/15 18:38
  • by jsanders