Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a full list of local users defined on a Windows Server 2003. It is not a part of an AD domain. I have found typing "NET USER" on the command line lists all users, but it does not include the Description or Full Name field, which I need. I can't find any command line option for it either.

It doesn't HAVE to be command line. The clue is I need to copy-paste the data into a processable format. The Computer Manager console is not a fan of copy pasting.

share|improve this question

Copy this into a .JS file.

var objWMIService = GetObject("winmgmts:\\\\.\\root\\cimv2");

var listLocalUsers = objWMIService.ExecQuery("SELECT * from Win32_UserAccount Where LocalAccount = True");

for(var enumLocalUser = new Enumerator(listLocalUsers); !enumLocalUser.atEnd(); enumLocalUser.moveNext()){
    var localUser = enumLocalUser.item();
    WScript.Echo("Short Name: " + localUser.Name);
    WScript.Echo("Full Name: " + localUser.FullName);
    WScript.Echo("Description: " + localUser.Description);

VB example: On Error Resume Next Set objWMIService = GetObject("winmgmts:\.\root\cimv2") Set listLocalUsers = objWMIService.ExecQuery("Select * from Win32_UserAccount Where LocalAccount = True")

For Each localUser in listLocalUsers 
    Wscript.Echo "Short Name: " & localUser.Name 
    Wscript.Echo "Full Name: " & localUser.FullName 
    Wscript.Echo "Description: " & localUser.Description 
    Wscript.Echo "\n"

Then run it using cscript myGetLocalUsers.js or cscript myGetLocalUsers.vb at the command prompt.


I haven't tested it so let me know if you get any errors.

share|improve this answer
The VB Script part worked, except I had to change objItem.Name to localuser.Name. Thanks very much! I also did some changes so that it's saved to file instead of displayed in message boxes. Final script here, for anyone interested: – Nilzor Mar 7 '12 at 11:48
Just for the record the JS script gave an error on line 1 char 1, but might be something I did wrong. Never mind though, solved the problem. – Nilzor Mar 7 '12 at 11:52
The JS script works just fine for me. Glad that it worked out. – surfasb Mar 7 '12 at 16:54
After running the script, the wmiprvse.exe network service process pegged itself to 99% CPU and had to be terminated. Microsoft acknowledges this behavior and furnishes a hotfix. – user308781 Mar 19 '14 at 0:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .