≡ Menu

wmic useraccounts

We can manager user accounts on a Windows computer using wmic commands. You can find commands for various operations below.

List user accounts:

wmic useraccount get name

The above command will list the login names of all the users on the local computer. To print login name and full name we can
run the below command.

wmic useraccount get name,fullname

Lock user account:

wmic useraccount where name='username' set disabled=false

Unlock user account:

wmic useraccount where name='username' set disabled=true

Remove password requirement for logging in:

wmic useraccount where name='username' set PasswordRequired=false

Rename user account:

wmic useraccount where name='username' rename newname

Restrict user from changing password

wmic useraccount where name='username' set passwordchangeable=false

The above commands can be run on all Windows editions. On Vista and Windows 7, these commands should be run from elevated windows command prompt.


16 comments… add one
  • Tal

    very nice summary.
    Do you know how can I create user account with using something like :
    WMIC USERACCOUNT create Name=”demo”

    thank you,

    • admin

      I have tried ‘useraccount create’ but it has not worked for me. You may try net user

  • Eric J

    Thanks for this information! WMIC is a new tool that I’ve bumped into a few days ago. It has such a wealth of information in it and it has become one of my favorite ones to use now.

  • don

    when you put “where name=’username'”

    is there a way to do that for multiple usernames in one command?
    Preferably faster than using the & command

  • Duveth

    I have a problem with this type of command.

    I usually run the following statement to obtain security information for auditing purposes. However for the OS Windows Server 2008 the same command is not working and I do not know what should I change to run it.

    wmic /output:temp.csv useraccount get Name /format:csv
    more temp.csv > temp.tmp
    Echo > UsersDetail.txt

    If you know, please let me know.

    • krishna mishra

      c:/>wmic /output:temp.csv useraccount
      ——-use this commond to get the details

  • Andy

    When I use this: wmic useraccount where name=’Administrator’ rename localadmin
    I am successful but the Full Name of the account is not changing.
    When I start WMIC and querry useraccount Caption lists localadmin but Fullname is still listed as Administrator. Also the user name does not appear changed at the login screen or anywhere else.

    Any ideas?

  • Mark

    wmic useraccount where (domain=’%computername%’ and name=’peter’) get name,fullname
    FullName Name
    peter peter

    wmic useraccount where (domain=’%computername%’ and name=’peter’) set fullname=peterpan

    wmic useraccount where (domain=’%computername%’ and name=’peter’) get name,fullname
    FullName Name
    peterpan peter

  • Chetan

    What is the WMI cammand to Force Change password at next login?

    Please help.

  • Antonio

    Sorry, to change the Admin Password, where is the line?
    I have this:

    useraccount where “name=’administrador'” set “password=’prueba'”

    But return

    Description: Not found

  • Soma

    how to get the password last set for local user for bunc of servers ?

  • Tracy

    I get alias not found whether I use brackets back slashes space in between user and account or not use just user whatever I do. I just want to list all users and there SIDs in windows 10 and figure out why there were 20 users on my facebook url and why it stopped working it used to be simple to get this list.

  • kamartaj

    when i run commonds for lock the user account which is: wmic useraccount where name=’username’ set disabled=false it shows, Error: Description = Invalid query,and wmic useraccount get name,full name,Error: Description=Invalid query, and same one is:
    wmic useraccount where name=’uername’ set PasswordRequired=false it also show Error: Description = Generic failure, please help me i do not want any type of login user and password help me disable or delete any kind of user account i am very said
    thank you….

    • Suresh

      For invalid query error , change the statement after WHERE to “Name=’username'”

  • Menashe

    This is little mistake in lock user account command: wmic useraccount where name=’username’ set disabled=false
    it most to be “true”
    and same in the unlock user account.

Leave a Comment