The main subroutine is the following:

vb Code:
  1. Public LocalProfilePaths As List(Of String) = New List(Of String)
  2.     Public localKey = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64)
  3.     Public RegistryPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList"

vb Code:
  1. Sub GetLocalProfiles()
  2.         localKey = localKey.OpenSubKey(RegistryPath)
  3.         For Each subKeyName As String In localKey.GetSubKeyNames
  4.             Dim KeyToCheck = RegistryKey.OpenBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, RegistryView.Registry64)
  5.             Dim newkey = RegistryPath & "\" & subKeyName
  6.             Try
  7.                 Dim ProfilePath = KeyToCheck.OpenSubKey(newkey).GetValue("ProfileImagePath")
  8.                 If Not (ProfilePath.IndexOf("windows", StringComparison.OrdinalIgnoreCase) >= 0) = True Then
  9.                     LocalProfilePaths.Add(ProfilePath)
  10.                 End If
  11.             Catch ex As Exception
  12.             End Try
  13.         Next
  14.     End Sub

This will enumerate through all the registry SIDs/profiles and get the profile path from the "ProfileImagePath"

Furthermore if the profileimagepath contains c:\windows\ or C:\Windows\ it will skip including it as these are system/service accounts.

You can also trim the path to get the username with something like this:

vb Code:
  1. Try
  2.             For Each Profile As String In LocalProfilePaths
  3.                 Dim ProfileName = Profile.Split(Path.DirectorySeparatorChar).GetValue((Profile.Split(Path.DirectorySeparatorChar).Length - 1)).ToString()
  4.                 console.writeline("My profile name: " & ProfileName)
  5.                 'Do stuff
  6.             Next
  7.         Catch ex As Exception
  8.         End Try