|
-
Jun 6th, 2006, 02:29 AM
#1
Thread Starter
Fanatic Member
[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
-
Jun 6th, 2006, 02:46 AM
#2
Re: Enumerating user accounts on network
How about using WMI?
VB Code:
Dim thisComputer As String
Dim oWMIService As Object
Dim oItems As Object
Dim 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
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jun 6th, 2006, 02:58 AM
#3
Thread Starter
Fanatic Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|