Sign in to follow this  
Followers 0
oviradoi

Get user list in Win XP / Vista

3 posts in this topic

Hello.

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



#2 ·  Posted (edited)

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 & "|"
    Next
    Return SetError(0, 0, StringSplit(StringTrimRight($sTmp, 1), "|"))  
EndFunc

Cheers

Edit: corrected function name.

Edited by smashly

Share this post


Link to post
Share on other sites

Thanks!

You guys are great! muttley

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  
Followers 0