Wednesday, August 18, 2010

Improved batch for DSFR monitoring

For those of you who have followed my post on DFSR monitoring, here's a better version of the batch file. I used DIRUSE.EXE to get some information I previously calculated with for loops...

Here's the code:

@echo off
setLocal EnableDelayedExpansion
echo Date Time Hidden_MB_1 Hidden_MB_2 Conflict_MB_1 Conflict_MB_2 Conflict_#_1 Conflict_#_2 Staging_MB_1 Staging_MB_2 DiskFree_F_1 DiskFree_F_2 > c:\supervi.txt
set member1=your_DFSR_member_1
set member2=your_DFSR_member_2
set diskvolume=f$


for /f "delims=" %%a in ('diruse \\%member1%\%diskvolume% /M /S ^| find "System Volume Information\DFSR" ^| find /V "DFSR\"') do @set value1a=%%a
set dfsr_hidden_size_1a=%value1a:~3,13%

for /f "delims=" %%a in ('diruse \\%member2%\%diskvolume% /M /S ^| find "System Volume Information\DFSR" ^| find /V "DFSR\"') do @set value1b=%%a
set dfsr_hidden_size_1b=%value1b:~3,13%

for /f "delims=" %%a in ('diruse \\%member1%\%diskvolume% /M /S ^| find "ConflictAndDeleted" ^| find /V "ConflictAndDeleted\"') do @set value2a=%%a
set dfsr_conflict_size_2a=%value2a:~3,13%

for /f "delims=" %%a in ('diruse \\%member2%\%diskvolume% /M /S ^| find "ConflictAndDeleted" ^| find /V "ConflictAndDeleted\"') do @set value2b=%%a
set dfsr_conflict_size_2b=%value2b:~3,13%

set /a how_many3a=0
set Fldr3a=\\%member1%\%diskvolume%\data_to_replicate\DfsrPrivate\ConflictAndDeleted
FOR /R "%Fldr3a%" %%I IN (*) DO set /a how_many3a=!how_many3a!+1

set /a how_many3b=0
set Fldr3b=\\%member2%\%diskvolume%\data_to_replicate\DfsrPrivate\ConflictAndDeleted
FOR /R "%Fldr3b%" %%I IN (*) DO set /a how_many3b=!how_many3b!+1

for /f "delims=" %%a in ('dir /s \\%member1%\%diskvolume%\data_to_replicate\dfsrprivate\staging ^| find "File(s)"') do @set value4a=%%a
set dfsr_staging_4a=%value4a:~24,16%

for /f "delims=" %%a in ('dir /s \\%member2%\%diskvolume%\data_to_replicate\dfsrprivate\staging ^| find "File(s)"') do @set value4b=%%a
set dfsr_staging_4b=%value4b:~24,16%

FOR /F "tokens=*" %%A IN ('dir \\%member1%\%diskvolume% ^| FIND "bytes free"') DO SET freedisk_f_1=%%A
FOR /F "tokens=*" %%A IN ('dir \\%member2%\%diskvolume% ^| FIND "bytes free"') DO SET freedisk_f_2=%%A

echo %date% %time% %dfsr_hidden_size_1a% %dfsr_hidden_size_1b% %dfsr_conflict_size_2a% %dfsr_conflict_size_2b% !how_many3a! !how_many3b! %dfsr_staging_4a% %dfsr_staging_4b% %freedisk_f_1% %freedisk_f_2% >> c:\supervi.txt

rem sleep 300

goto beginning

1 comment:

  1. Just note that you could get a fixed size for the hidden folder: 8192MB, or 8GB. This is because it contains the similaritytable_1 or similaritytable_2 files, which are sparse files whose space is not really allocated on the disk.

    For more information on sparse files in NTFS:


Related Posts Plugin for WordPress, Blogger...