-
Notifications
You must be signed in to change notification settings - Fork 5
local_user_admin_create.ps1
Corey Watson edited this page Dec 24, 2025
·
2 revisions
Creates or updates a local administrator account with a cryptographically secure random password.
This script creates or updates a local administrator account with a cryptographically secure random password. If the account exists, it resets the password. If not, it creates the account and adds it to the Administrators group.
Creates or updates a local administrator account with a cryptographically secure random password. If the account exists, resets the password. If not, creates the account and adds it to the Administrators group.
- Windows 10/11
- Admin privileges required
- PowerShell 5.1+
- Hardcoded values (username)
- RNG for password generation
- AdminUsername : Username for the local admin account (default: sudohawk)
- Password length: 16 characters
- Password includes: uppercase, lowercase, numbers, special characters
- Account added to local Administrators group
- Generates cryptographically secure random password
- Checks if user account exists
- If exists: resets password
- If not exists: creates account and adds to Administrators group
- Outputs password (for RMM custom field capture)
- Password generated using RNGCryptoServiceProvider
- Password output to console for RMM capture only
- Consider storing password securely in RMM custom fields
- 0: Success
- 1: Failure
[ INPUT VALIDATION ]
--------------------------------------------------------------
Admin Username : sudohawk
Password Length : 16
[ OPERATION ]
--------------------------------------------------------------
Checking for existing account...
Account does not exist, creating...
Account created successfully
Adding to Administrators group...
[ RESULT ]
--------------------------------------------------------------
Status : Success
Action : Created
Password : ****************
[ SCRIPT COMPLETED ]
--------------------------------------------------------------
- 2025-11-29 v1.0.0 Initial Style A implementation
- View Script Source
- Scripts - Back to script index