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

PowerShellMicrosoft TechnologiesSoftware & Coding

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
raja
Published on 28-Apr-2021 13:38:40
Advertisements