How to get all the user profiles on the System using PowerShell?



All the new user profiles are created on the windows system at the path,

'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\'

To retrieve all the user profiles, we can use

gci 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\' | ForEach-Object { $_.GetValue('ProfileImagePath') }

ProfileImagePath property shows the location of the user profiles.

Another way to retrieve the User Profile is using WMI.

PS C:\> gwmi win32_userprofile |Select -ExpandProperty LocalPath

Output

C:\Users\.NET v2.0 Classic
C:\Users\.NET v4.5 Classic
C:\Users\.NET v2.0
C:\Users\.NET v4.5
C:\Users\Classic .NET AppPool
C:\Users\Administrator.AUTOMATIONLAB
C:\Users\delta

Advertisements