Read User Profiles from Registry

by Mar 20, 2015

All versions

To find out which users have a (local) user profile on your machine, and where this profile is located, try this snippet:

$path = 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\*'

Get-ItemProperty -Path $path |
  Select-Object -Property PSChildName, ProfileImagePath

It will automatically enumerate all keys below ProfileList, and return the user SID and the path to the profile:

 
PSChildName                              ProfileImagePath                        
-----------                              ----------------                        
S-1-5-18                                 C:\WINDOWS\system32\config\systemprofile
S-1-5-19                                 C:\Windows\ServiceProfiles\LocalService 
S-1-5-20                                 C:\Windows\ServiceProfiles\NetworkSer...
S-1-5-21-1907506615-3936657230-268413... C:\Users\Tobias                         
S-1-5-80-3880006512-4290199581-164872... C:\Users\MSSQL$SQLEXPRESS                
 

Twitter This Tip! ReTweet this Tip!