Home All Groups Group Topic Archive Search About

Obtaining complete User List

Author
24 Feb 2006 9:44 AM
Dave
Hi all,

My question is:  How do you obtain a complete list of all the users
that are registered on the local machine?  I've been trying for hours
now and can't find anything that will help on the groups.

Anyone have any idea how to do this in VB.NET?

thanks

Dave

Author
24 Feb 2006 3:20 PM
Peter Proost
Hi after a bit of searching I found this sample on the newsgroup which does
what you want:

Add reference to System.DirtectoryServices

Imports System.DirectoryServices

Dim de As DirectoryEntry
Dim Child As DirectoryEntry

de = New DirectoryEntry("WinNT://" & Environment.MachineName & ",computer")
'Filter for only "User" entries.
de.Children.SchemaFilter.Add("user")

Console.WriteLine("USERS:")
   For Each Child In de.Children
            Console.WriteLine(" - " & Child.Name)
   Next Child


Hope this helps

Greetz, Peter
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning. (Rich Cook)

Show quoteHide quote
"Dave" <davesa***@gmail.com> schreef in bericht
news:1140774269.512499.188830@v46g2000cwv.googlegroups.com...
> Hi all,
>
> My question is:  How do you obtain a complete list of all the users
> that are registered on the local machine?  I've been trying for hours
> now and can't find anything that will help on the groups.
>
> Anyone have any idea how to do this in VB.NET?
>
> thanks
>
> Dave
>