Jump to content
Sign in to follow this  

Get user list in Win XP / Vista

Recommended Posts



Does anyone know how to get a list of users in Windows XP / Vista using AutoIT?

I need a list of the user accounts created in Windows.

Share this post

Link to post
Share on other sites

Hi, not sure if it works in vista, but it works ok in xp.

#include <array.au3> ; Not needed by _ListUsers()

$LU = _ListUsers()
If Not @error Then _ArrayDisplay($LU, "List Users")

Func _ListUsers()
    Local $colUsers, $sTmp, $Array[1] = ["user"]
    $colUsers = ObjGet("WinNT://" & @ComputerName)
    If Not IsObj($colUsers) Then Return SetError(1, 0, 0)
    $colUsers.Filter = $Array
    For $objUser In $colUsers
        $sTmp &= $objUser.Name & "|"
    Return SetError(0, 0, StringSplit(StringTrimRight($sTmp, 1), "|"))  


Edit: corrected function name.

Edited by smashly

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.