wmic useraccounts

We can manage 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.

Advertisement
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 Windows 11 and Windows 10, these commands should be run from elevated Windows command prompt.

 

Advertisement

16 thoughts on “wmic useraccounts”

  1. 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.

    Reply
  2. 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….

    Reply
  3. 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.

    Reply
  4. Hi
    Sorry, to change the Admin Password, where is the line?
    I have this:

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

    But return

    Error
    Description: Not found

    Reply
  5. 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

    Reply
  6. 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?

    Reply
  7. 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.

    Reply
  8. 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

    Reply
  9. 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.

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

    thank you,
    Tal

    Reply

Leave a Comment