Results 1 to 3 of 3

Thread: [RESOLVED] Enumerating user accounts on network

  1. #1

    Thread Starter
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Resolved [RESOLVED] Enumerating user accounts on network

    Hi,

    I need to enumerate the user accounts on the network. I'm writing a program that should only be accessed by management and they're already complaining that they have to remember too many (2) passwords. What I want to do is check which account is loged in on the current PC and if they aren't suppose to have access, close the program. But I'd need to ba able to add users to my lis, and for that I want to have a list of all the user accounts so that I can just choose one from there.

    Any help would be greatly appreciated

    r0ach™
    Don't forget to rate the post

  2. #2
    Shared Member
    Join Date
    May 2005
    Location
    Kashmir, India
    Posts
    2,277

    Re: Enumerating user accounts on network

    How about using WMI?
    VB Code:
    1. Dim thisComputer As String
    2.     Dim oWMIService As Object
    3.     Dim oItems As Object
    4.     Dim cItems As Object
    5.    
    6.     thisComputer = "."
    7.     Set oWMIService = GetObject("winmgmts:\\" & thisComputer & "\root\CIMV2")
    8.     Set cItems = oWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", , 48)
    9.     For Each oItem In cItems
    10.         Debug.Print "FullName: " & oItem.FullName
    11.         Debug.Print "Name: " & oItem.Name
    12.         Debug.Print "Domain: " & oItem.Domain
    13.         Debug.Print "LocalAccount: " & oItem.LocalAccount
    14.     Next
    Use [code] source code here[/code] tags when you post source code.

    My Articles

  3. #3

    Thread Starter
    Fanatic Member r0ach's Avatar
    Join Date
    Dec 1999
    Location
    South Africa
    Posts
    722

    Re: Enumerating user accounts on network

    Shuja_Ali: That might just be exactly what I need!! I ran the code and it seems to return al the accounts. Didn't verify, but it'll do for now. Thank you.

    PS. rated!

    r0ach™
    Don't forget to rate the post

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width