Table of Contents

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

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

Reference

https://winaero.com/create-user-account-windows-10-powershell/