Jump to content

Get user list in Win XP / Vista


Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...