Using information and techniques from tips 0034 and 1087, I have scripted Persistent.bat to generate a CSV file of a users persistent shares. The CSV file contains "Device","\\ServerName\ShareName".

The syntax for using Persistent.bat is:

Persistent CSV_Folder

where CSV_Folder can be a local folder or a network share. The actual file is "CSV_Folder\UserName.CSV".

NOTE: If you wish to run Persistent.bat for all your users, place a call persistent CSV_Folder in your logon script.

Persistent.bat contains:

@echo off
setlocal
if \{%1\}==\{\} goto Syntax
if not exist %1\*.* goto Syntax
set folder=%1
set folder=%folder:"=%
set /a cntrpt=0
if exist "%folder%\%UserName%.csv" del /q "%folder%\%UserName%.csv"
regedit /a "%temp%\Persistent.reg" "HKEY_CURRENT_USER\Network"
for /f "Skip=3 Tokens=1* Delims=\\]=" %%a in ('type "%temp%\Persistent.reg"') do set p1=%%a&set p2=%%b&call :report
set rmt="%rmt:\\=\%"
set rmt="%rmt:"=%"
if defined dvc set /a cntrpt=%cntrpt% + 1&@echo "%dvc%",%rmt%>>"%folder%\%UserName%.csv"
if exist "%temp%\Persistent.reg" del /q "%temp%\Persistent.reg"
@echo %UserName% has %cntrpt% report lines.
endlocal
goto :EOF
:Syntax
@echo Syntax: Persistent ReportFolder
endlocal
goto :EOF
:report
set p1=%p1:"=%
if "%p1:~0,1%" EQU "\[" goto new
if /i "%p1%" EQU "RemotePath" set rmt=%p2%
goto :EOF
:new
set rmt="%rmt:\\=\%"
set rmt="%rmt:"=%"
if defined dvc set /a cntrpt=%cntrpt% + 1&@echo "%dvc%",%rmt%>>"%folder%\%UserName%.csv"
set rmt=
set dvc=%p2%
set dvc=%dvc:\]=%
set dvc=%dvc:Network\=%