Add a new admin user to Windows 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
$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.