User Tools

Site Tools


powershell-commands-add-admin

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

powershell-commands-add-admin.txt · Last modified: by jsanders