Here is a little function I put together that returns a list of all user account names on the specified computer.

You need to add a reference to System.DirectoryServices to be able to use this function.

Function:

vb Code:
  1. ''' <summary>
  2. ''' Returns a list of user accounts found on the specified computer
  3. ''' </summary>
  4. ''' <param name="MachineName">The computer to get user accounts from</param>
  5. Private Function GetLocalUsers(ByVal MachineName As String) As List(Of String)
  6.         Dim WinNt As New DirectoryServices.DirectoryEntry("WinNT://" & MachineName)
  7.         Dim UserList As New List(Of String)
  8.  
  9.         For Each User As DirectoryServices.DirectoryEntry In WinNt.Children
  10.             If User.SchemaClassName = "User" Then
  11.                 UserList.Add(User.Name)
  12.             End If
  13.         Next
  14.  
  15.         Return UserList
  16. End Function


Example:

If you just want it to return the usernames on the local computer then just pass the string "localhost" in as the machine name, like so:

vb Code:
  1. 'Get the users, using our GetLocalUsers function
  2. Dim Users As List(Of String) = GetLocalUsers("localhost")
  3.  
  4. 'loop through the users and show each user in a messagebox
  5. For Each User As String In Users
  6.       MessageBox.Show(User)
  7. Next