Categories: User Accounts

Rename local user account

I have been asked this question many times on this blog – ‘How to rename a local user account from command line?’ Well, net user command supports most of the user account related operations that we can do from Control Panel-> User accounts in GUI. It supports password reset, locking or unlocking user accounts, adding users to groups etc. One thing the GUI supports and net user  command does not support is renaming user accounts. Still, there is a way to do that from windows command line.  We need to use WMIC Useraccount command for doing this.

Below is the command for renaming a local user account on a computer.

wmic useraccount where name='currentname' rename newname

Example: To rename the user account ‘xpuser’ as ‘win7user’ we can run the below command.

wmic useraccount where name='xpuser' rename win7user

Using this command we can rename administrator account also. The below command changes the user name from ‘administrator’ to ‘admin.’

wmic useraccount where name='administrator' rename admin

The above wmic commands work on XP, Server 2003, Vista, Windows 7 and Server 2008. On Vista and Windows 7, you need to run the commands from elevated command prompt.

Srini

View Comments

  • Love this, thanks much... The gui would not perm change the uname, this worked like 'magic'. PS: not real email, but sentiment is legit!

  • I recently renamed my user account, but the command prompt still shows my old name under , what gives?

  • This is perfect! Thanks so much. Had never heard of this command before. Had to use it to change the guest account name in Windows 8.1 (non-pro) before activating the account for the first time. Only other way to change the guest account name is to activate it and change in the user accounts panel, but then certain elements of the account still refer to "Guest". I then used "net users" to verify the change.

    Win8 Elevated Command Prompt: StartKey+X or Right click Start button, click on "Command Prompt (Admin)"

  • I unfortunately either deleted the only administrator account I had in my Control Panel, or inadvertently changed it incorrectly. I tried every one of your suggestions, and none of them worked. I'm still hoping you can get an administrator for me for Users in the Control Panel, please. Thank You

Recent Posts

Add new user account from command line (CMD)

Adding users from command line is much easier than going through the UI. It saves…

4 years ago

Delete directory from command line [Rmdir]

Do you want to delete a directory from Windows command prompt(CMD)? This post explains how…

4 years ago

TaskKill: Kill process from command line (CMD)

We can kill a process from GUI using Task manager. If you want to do…

4 years ago

Kill Chrome from command line

Chrome is definitely the stable browser compared to other ones and it has been my…

4 years ago

Find windows OS version from command line

Windows has multiple command line utilities that can help find the version of the Windows…

4 years ago

How to check if Windows 32 or 64 bit?

There are multiple ways to check whether a Windows computer is running 32-bit OS or…

7 years ago