A temporary Windows account should not become a permanent houseguest. Whether you are lending a PC to a contractor, setting up a short-term training device, or creating a separate account for a visitor, Windows can enforce an end date without third-party tools. The built-in net user command in Windows 10 and Windows 11 can create a local account, assign it an expiration date, and later extend, disable, or remove it.

Microsoft’s current command reference lists net user as supported on both Windows 10 and Windows 11. Crucially, an account set to expire on a given date expires at the beginning of that date—a detail that can turn a well-planned Friday cutoff into an unexpected Friday-morning lockout.

A Windows desktop shows a command prompt creating a temporary account that expires June 30, 2025. Before you start​

You need to sign in with an account that has local administrator rights, then open Command Prompt as administrator:

  1. Search for Command Prompt from Start.
  2. Select Run as administrator.
  3. Approve the User Account Control prompt.

This guide creates a local-only account. It is tied to that PC rather than a Microsoft account, organization account, or cloud identity. That is useful for temporary device access, but it also means the account’s files and profile remain on the computer until you remove them.

Choose a short, recognizable account name—Microsoft documents a maximum of 20 characters for the net user account name field. For this example, the account will be called TempVisitor.

Create the expiring local account​

Run the following command:

net user TempVisitor * /add /expires:May,1,2027 /fullname:"Temporary Visitor" /comment:"Access expires after Apr 30, 2027"

Windows will prompt you to enter the password twice. The asterisk is deliberate: it lets you enter the password securely instead of placing it in the command history or leaving it visible on screen.

What the command does​

PartPurpose
TempVisitorThe Windows sign-in name
*Prompts securely for a password
/addCreates the local account
/expires:May,1,2027Sets the account expiration date
/fullname:Adds a readable display name
/comment:Records why the account exists

The date format deserves special care. Microsoft supports numeric and month-name formats, with accepted numeric ordering influenced by the device’s regional settings. Using a written month, such as May,1,2027, avoids the classic 04/05 date-format argument that has haunted administrators since calendars were invented.

Because the account expires at the start of May 1, 2027, the user can sign in through April 30, 2027. If you instead set /expires:Apr,30,2027, access ends as soon as April 30 begins.

Keep it a standard account​

A temporary user normally should be a standard user, not a local administrator. Standard accounts can use installed software and work with their own files, but they cannot silently install system-wide software, alter protected settings, or make the sort of changes that turn a quick favor into a cleanup project.

Microsoft’s account-security guidance recommends limiting the number of administrators and using standard accounts for everyday work.

First, check whether the account appears in the local Administrators group:

net localgroup Administrators

Review the displayed member list. TempVisitor should not appear there.

Then inspect the standard local Users group:

net localgroup Users

On a typical English-language Windows installation, the temporary account should appear in that group. If the account is not listed, add it:

net localgroup Users TempVisitor /add

If Windows says the account is already a member, that is fine; the group membership is already in place. Do not run a command that adds the account to Administrators merely to make setup easier. Temporary access with permanent-level privileges is a security policy written in disappearing ink.

Verify the expiration setting​

Use this command to view the account’s complete local configuration:

net user TempVisitor

Look for these entries in the output:

Code:
Account active               Yes
Account expires              5/1/2027

The exact displayed date format may vary by Windows region and language settings. What matters is that the expiration date matches the intended cutoff.

This check is more than ceremonial. It confirms that Windows accepted the date rather than defaulting the account to “Never,” which is the normal expiration setting for newly created accounts.

Test access before handing over the PC​

Before giving the account to someone else, test it like an administrator who does not enjoy surprise support calls.

  1. Save your work in the administrator session.
  2. Open Start, select your account icon, and choose Switch user.
  3. Select TempVisitor.
  4. Enter the temporary account password.
  5. Confirm that Windows opens a new desktop and does not request administrator credentials for routine actions.

Then return to your administrator account and verify the profile was created:

net user TempVisitor

For a deeper check, confirm that TempVisitor still does not appear under:

net localgroup Administrators

If it does appear there, remove the unwanted elevated membership immediately:

net localgroup Administrators TempVisitor /delete

Extend the account safely​

Plans change. If the visitor needs another week, change only the expiration date:

net user TempVisitor /expires:May,8,2027

Then verify it:

net user TempVisitor

To remove the expiration date entirely, use:

net user TempVisitor /expires:never

That last command is useful for converting a formerly temporary account into a continuing local account, but it should be a conscious decision—not a forgotten exception that survives long after the reason for access has vanished.

Disable access early or remove the account​

If access must stop before the scheduled date, disable the account without deleting its profile:

net user TempVisitor /active:no

That prevents sign-in while preserving the account and its files for review. To re-enable it later:

net user TempVisitor /active:yes

When the account is no longer needed, delete the sign-in identity:

net user TempVisitor /delete

Deleting the account removes the account record, but do not assume it automatically handles every file you may want to retain. Review and back up any needed data from the user profile first. On shared PCs, that profile is commonly found under C:\Users\TempVisitor.

Common problems and fixes​

“System error 5 has occurred. Access is denied.”​

Command Prompt was not opened with elevated administrator rights. Close it, then select Run as administrator and try again.

“The user name could not be found.”​

Check the spelling with:

net user

This lists local accounts known to the PC.

The account expires a day sooner than expected​

This is expected behavior if the expiration date was treated as the first blocked day. Set the date to the day after the last intended day of access.

The password is rejected​

Local password policies may require a minimum length or complexity. Microsoft notes that net user respects the password requirements configured for the device. Choose a stronger password rather than weakening the policy merely for a temporary account.

The practical takeaway​

net user remains one of Windows’ most useful old-school administrative tools: no downloads, no cloud enrollment, and no treasure hunt through Settings menus. For a time-limited local account, the reliable workflow is simple:

  1. Create the account with a prompted password.
  2. Set the expiration date one day after the final permitted access date.
  3. Confirm it is not a member of Administrators.
  4. Verify the configuration with net user.
  5. Disable or delete it when the assignment is complete.

For Windows 11 updates and Windows 10 systems alike, this is a clean, auditable way to grant temporary PC access without letting a short-term account quietly become part of the furniture.