JSI Tip 9953. How can I output, in CSV format, the offline cache settings for my Windows XP shares using information from the registry?

Jerold Schulman

December 5, 2005

1 Min Read
ITPro Today logo in a gray background | ITPro Today

In tip 9936, we generated a CSV format output of the offline cache settings for Windows workstation and Windows Server shares, using the net share command.

I have scripted OLCREG.BAT to output the offline cache settings for a Windows XP workstation, using information from the registry.

When you type OLCREG in a CMD.EXE window, the output is displayed on the console in the following format:

"Share Name","File System Path","Cache Setting"Where Cache Setting can be one of the following:Manual caching of documentsAutomatic caching of documentsAutomatic caching of programs and documentsCaching disabled.

OLCREG.BAT contains:

@echo offsetlocal ENABLEDELAYEDEXPANSIONset qry=reg QUERY "HKLMSystemCurrentControlSetServicesLanmanserverShares"set fnd=find "REG_MULTI_SZ"for /f "Tokens=1,2*" %%a in ('%qry%^|%fnd%') do ( set line=%%c set line=!line:=#! for /f "Tokens=2,6 Delims=#=," %%i in ('@echo !line!') do (  call :out "%%a" "%%i" "%%j" ))endlocalgoto :EOF:outif %2 EQU "0" set cc="Manual caching of documents"&goto out1if %2 EQU "16" set cc="Automatic caching of documents"&goto out1if %2 EQU "32" set cc="Automatic caching of programs and documents"&goto out1if %2 EQU "48" set cc="Caching disabled":out1@echo %1,%3,%cc%



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like