CodeItBetter Programming Another VB Programming Blog

How to Enumerate user accounts on network

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'Network - How to Enumerate user accounts on 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
Filed under: Network Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.