Differences
This shows you the differences between two versions of the page.
— |
powershell-commands-add-admin [2025/04/17 18:30] (current) jsanders created |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== 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.// | ||
+ | |||
+ | ==== Reference ==== | ||
+ | https://winaero.com/create-user-account-windows-10-powershell/ |