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
-
insert in master table and update in other table
by shahid123 (0 replies)
-
sending sms from pc
by sriraj20074 (0 replies)
-
add [DOT] to text line
by kayatri (0 replies)
-
Looping in text file
by kayatri (0 replies)
-
need help in designing a media player using vb.net/ocx object
by kensville (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.