Using information from tip 4631 » How do I recovery a lost local user profile, I have scripted ValidProfiles.bat to display the SID and ProfileImagePath for the valid profiles that are located in your %SystemDrive%\Documents and Settings folder.

To run ValidProfiles.bat, open a CMD.EXE windows and type ValidProfiles.

NOTE: Reg.exe is built into Windows XP, Windows Server 2003, and later, or installed from the Support Tools folder of the Windows 2000 CD-ROM.

ValidProfiles.bat contains:

                              @echo off                              setlocal ENABLEDELAYEDEXPANSION                              set qry=reg QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /s                              set fnd1=FIND /I "Documents and Settings"                              set fnd2=FIND /I "ProfileImagePath"                              set blank=                                                                 #                              set work=SID%blank%                              set head1=%work:~0,60%                              set head2=ProfileImagePath                              @echo %head1%  %head2%                              for /f "Tokens=*" %%a in ('%qry%') do (                               set line=%%a                               set work=!line:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\=!                               if "!work!" NEQ "!line!" set SID=!work!%blank%&set SID=!SID:~0,60!                               for /f "Tokens=1,2*" %%i in ('@echo %%a^|%fnd1%^|%fnd2%') do (                                @echo !SID! "%%k"                               )                              )                              endlocal