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).

Peter Rekdal Sunde
AddThis

Related discussion

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...

Want to stay in touch with what's going on? Follow us on twitter!