This content is not currently approved and is visible here for review only.

Library code snippets

List of local users on a computer

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.

Comments

  1. 01 Jan 1999 at 00:00

    This thread is for discussions of List of local users on a computer.

Leave a comment

Sign in or Join us (it's free).

AddThis

Related jobs

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!