Skip to content

How to Create a Local Administrator Account without Exposing the Password Print

  • 0

A local administrator account can provide an approved administrative or recovery identity on a standalone or member server. Create it with a unique password entered through a secure prompt, grant only the intended membership and give it a defined lifecycle. An account that is secure on the day it is created still needs ownership, monitoring and eventual removal or credential rotation.

This guide applies to Windows Server 2019, 2022 and 2025 using 64-bit Windows PowerShell. It is not a domain-controller account procedure: domain controllers do not use ordinary local user administration in the same way as member servers. Confirm the server’s role and policy before creating an identity.

Decide whether a local administrator is appropriate

Use an individually attributable domain administrative identity where the approved design calls for one. A local account may be needed for a standalone machine, controlled recovery or another documented purpose, but it should not become a shared everyday login for an entire team.

Identify the owner, permitted uses, approval reference and review date. For temporary work, define the expiry or removal condition before creation. For emergency recovery, define who can retrieve the credential and how that retrieval is recorded and followed by rotation.

Consider Windows LAPS for supported, policy-managed local credential rotation and backup. Its configuration needs an appropriate directory and permissions design; creating a manual account does not automatically enroll it in LAPS. Coordinate with the team that owns that policy.

Prepare an existing authorized session

Open 64-bit Windows PowerShell as administrator using an existing approved identity. The LocalAccounts module is unavailable in 32-bit PowerShell on a 64-bit system, so verify the shell and required commands before troubleshooting permissions:

[Environment]::Is64BitProcess
Get-Command New-LocalUser, Add-LocalGroupMember, Enable-LocalUser
Get-CimInstance Win32_ComputerSystem |
    Select-Object Name, Domain, DomainRole

Confirm this is the intended server and that the role permits local account management. Keep the original administrator session and console recovery available until the new account has been tested. Do not disable an existing recovery account merely because the replacement command appears to succeed.

Choose a meaningful approved name and check whether it already exists. Do not delete or reset an existing account to reuse the name without investigating its purpose and dependencies.

Prompt for the password without putting it in history

The example account name below is illustrative. Replace it with the approved identity and check the result:

$accountName = 'OpsAdmin' # Replace with the approved account name.
Get-LocalUser -Name $accountName -ErrorAction SilentlyContinue

If the account exists, stop and review it rather than continuing as though it were new. For a new identity, obtain a unique password through a protected prompt:

$password = Read-Host 'Enter the approved unique password' -AsSecureString

The password is not printed or included as a literal in the command. Do not use ConvertTo-SecureString with a real plain-text password embedded in the script; that preserves the secret in history or the file even if the resulting object is called secure.

A SecureString prompt does not make an untrusted endpoint safe or replace a password-management policy. Use a trusted administrative device and deliver or store the credential through the approved secret-management process. Never ask someone to paste it into a support ticket for verification.

Create the account in a disabled state

Create the account with a purpose description and keep it disabled while membership is reviewed:

$newUser = New-LocalUser -Name $accountName -Password $password `
    -FullName 'Approved Operations Administrator' `
    -Description 'Approved server administration; see access register' -Disabled
$newUser | Select-Object Name, Enabled, SID, Description

Expect the chosen account with Enabled set to false. If password policy rejects the value, use another compliant unique password through the secure prompt. Do not weaken the machine’s password policy to make this example succeed.

The example deliberately does not set PasswordNeverExpires or create a passwordless account. Apply expiry, rotation and change requirements according to the approved account type. If temporary access needs an account-expiration date, select an explicit date and time suitable for the business process rather than copying an arbitrary deadline.

Add the exact local identity to Administrators

Find the built-in Administrators group through its well-known SID, which avoids depending on a localized group name. Pass the newly created user object so a same-named domain identity cannot be selected accidentally:

$administrators = Get-LocalGroup -SID 'S-1-5-32-544'
Add-LocalGroupMember -Group $administrators -Member $newUser
Get-LocalGroupMember -Group $administrators

Review the account SID and membership. A bare short name on a domain member can be ambiguous; the local user object makes the intended principal explicit. Do not add unrelated domain groups or all application users to Administrators to simplify account testing.

Administrator membership gives broad control of the machine. It is not the right solution for someone who only needs access to a shared folder, a report or an application’s normal functions. Resolve those needs through the relevant permission group.

Enable and test through the intended access route

Once the account and membership match the approval, enable that account:

Enable-LocalUser -Name $accountName
Get-LocalUser -Name $accountName |
    Select-Object Name, Enabled, SID, PasswordLastSet, PasswordExpires

Test a separate controlled sign-in before ending the original session. Use the explicit local account context, such as SERVERNAME\OpsAdmin, with the actual server and account names. Confirm the target and identity, then perform a harmless administrative check.

Local administrator membership does not automatically guarantee every remote logon path. Effective policy can deny network or Remote Desktop logon, and remote UAC behaviour can affect some administrative connections. Diagnose the chosen access method instead of weakening those protections globally.

If the account is intended only for recovery at the console, do not broaden remote access simply to make a Remote Desktop test pass. Test the path the account is actually authorized to use.

Record lifecycle details without recording the secret

Document the owner, purpose, local SID, approved groups, retrieval method, rotation responsibility and removal condition. Keep the password in the approved protected store, separate from ordinary access records. Avoid descriptions containing a password hint or sensitive recovery information.

Review account use and membership periodically. Investigate unexpected sign-ins or changes rather than treating a recovery account as invisible background configuration. If Windows LAPS will manage the account, verify the policy applies and that authorized recovery can retrieve the current credential.

Remove the temporary password variable when it is no longer needed and close the administrative session normally. This reduces casual reuse in the session but is not a claim that every trace of sensitive data has been erased from memory or the endpoint.

Distinguish account state from active sessions

Disabling an account prevents new authentication through the normal account checks, but it should not be assumed to terminate every existing session or process immediately. During access revocation or an incident, review active sessions and tasks through the approved response procedure. Coordinate termination with the application owner so unsaved work and running services are considered. A password reset likewise needs an access review rather than an assumption that all previously established activity has vanished. Record the actions taken and verify the intended containment outcome.

Disable or remove the account safely

If creation was incorrect, disable the exact new account and review its membership. Remove privileges through the approved process, and delete the identity only after confirming that no service, task, file ownership or recovery procedure depends on it. Deleting and recreating the same name produces a different SID and does not automatically restore previous permissions.

When a temporary engagement ends, revoke access on schedule and rotate any credentials that were shared through an approved emergency process. Confirm another recovery route remains available before retiring an emergency administrator.

See security responsibilities and Microsoft’s New-LocalUser reference, local group membership guidance and Windows LAPS overview for supported account-management details.


Was this answer helpful?

« Back