Rename local user account

by admin on October 31, 2011

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.

{ 8 comments… read them below or add one }

Jeffrey A. Diaz November 16, 2011 at 10:26 am
Anonymous June 11, 2013 at 3:36 am

it say that wmic is not recognized as internal or external command

Reply

steve January 28, 2014 at 2:34 pm

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

Reply

admin January 28, 2014 at 4:35 pm

Thanks Steve for the comment. Appreciation like this keeps us going.
PS: no problem with the email id.

Ann April 24, 2014 at 3:53 am

Can not figure out how to change name. Help. Thank you

Reply

Cory May 24, 2014 at 4:30 pm

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

Reply

Indy May 28, 2014 at 12:57 am

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)”

Reply

prashant November 7, 2014 at 7:38 pm

Not working. It says “Prashant-Invalid alias verb”.

Reply

Leave a Comment

HTML tags are not allowed.

Previous post:

Next post: