How to Enumerate the user accounts on your system / network
Posted on January 5, 2009
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 'System & API - How to Enumerate the user accounts on your system / network Option Explicit Sub Main() Dim thisComputer As String Dim oWMIService As Object, oItem As Object, cItems As Object thisComputer = "." Set oWMIService = GetObject("winmgmts:\\" & thisComputer & "\root\CIMV2") Set cItems = oWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", , 48) For Each oItem In cItems 'Debug.Print "FullName: " & oItem.FullName Debug.Print "Name: " & oItem.Name 'Debug.Print "Domain: " & oItem.Domain 'Debug.Print "LocalAccount: " & oItem.LocalAccount Next End Sub |