Library code snippets
List of local users on a computer
By Peter Rekdal Sunde, published on 26 Jun 2008
Introduction
If you want a list of all the user accounts on Windows you just do the following:
1) You need to add System.DirectoryServices as a reference in your editor
2) Create a new project and copy-paste this code:
Imports System.DirectoryServices
Using root As New DirectoryEntry("WinNT://" & My.Computer.Name) ' WinNT://<domain>/<computer name>
For Each child As DirectoryEntry In root.Children
If child.SchemaClassName = "User" Then
Messagebox.show(child.Name)
End If
Next
End Using
Thanks to James Kovacs submitting this snippet. You can view the original snippet here.
1) You need to add System.DirectoryServices as a reference in your editor
2) Create a new project and copy-paste this code:
Imports System.DirectoryServices
Using root As New DirectoryEntry("WinNT://" & My.Computer.Name) ' WinNT://<domain>
For Each child As DirectoryEntry In root.Children
If child.SchemaClassName = "User" Then
Messagebox.show(child.Name)
End If
Next
End Using
Thanks to James Kovacs submitting this snippet. You can view the original snippet here.
Related articles
Related discussion
-
How to write a query set to excel using vb.net
by BarbaMariolino (1 replies)
-
Very Urgent regarding deleting the images from a folder
by rameshbandi (2 replies)
-
Block Accessing MSSQL 2000
by militia (0 replies)
-
.NET Developer in Ghana Required....
by sysview (0 replies)
-
Sending SMS to mobile using secure gateway from VB.net 2008 c#
by pratikasthana17 (0 replies)
Related podcasts
-
xpert to Expert: Inside Concurrent Basic (CB)
"Concurrent Basic extends Visual Basic with stylish asynchronous concurrency constructs derived from the join calculus. Our design advances earlier MSRC work on Polyphonic C#, Comega and the Joins Library. Unlike its C# based predecessors, CB adopts a simple event-like syntax familiar to VB progr...
This thread is for discussions of List of local users on a computer.