I like to monitor, if the access from any server to a file share is still accessible. Our customer wants a monitor and have proof, which shows them, that the access to certain file shares are working fine.
Following batch I found on the net, but it is not working as I hoped.
The issue is that even I cannot copy the file due to "Access is denied" to the share, the sensor is still green "OK" and shows me a time how long it took to copy the file, which in reality, no file was copied.
I need a sensor, which tells me, the file was copied (green ok) or not copied (red down), the time is secondary and actual not needed.
@echo off FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO ( set Milisecond=%time:~9,2% set Day=%%A set Hour=%%B set Minute=%%C set Second=%%D ) set /a Start=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond% net use \\server-a\c$\temp password /user:domain\user copy c:\temp\test-file.txt \\server-a\c$\temp FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO ( set Milisecond=%time:~9,2% set Day=%%A set Hour=%%B set Minute=%%C set Second=%%D ) set /a End=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond% set /a Diff=%End%-%Start% echo %Diff%:ok
Thanks for any advice in advance
Add comment