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
-
i have struck with my project in vb.net
by jetski (4 replies)
-
Error in VB code
by glib162002 (0 replies)
-
Very slow inserts using SqlCommand.ExecuteNonQuery()
by porchelvi (1 replies)
-
Datagridview Setting datasource property of datagridviewcomboboxcell at run time
by sairfan1 (2 replies)
-
vb.net mp3 +g player
by novavb6 (1 replies)
Related jobs
-
Microsoft .Net Architect
in AMSTERDAM (€50K-€90K per annum)
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
This thread is for discussions of List of local users on a computer.