I'm looking to create a sensor that will (on a schedule) run against the device to scan it and report back if there are SFC errors found I have created the following, but its not working. I have not really writing something like this for PRTG, but there is a use case for it due to newer Windows Server OS. Basically its a validate scan only, and if it finds "errors" the sensor would be red, if none are found its green.
@echo off IF NOT EXIST C:\temp MKDIR C:\temp set temp-txt=C:\temp\sfc.txt sfc.exe /verifyonly>>%temp-txt% findstr /m "found integrity violations" %temp-txt% >Nul if %errorlevel%==1 ( set errorlevel=0 ) if %errorlevel%==0 ( set errorlevel=1 ) del %temp-txt% echo ^<?xml version="1.0" encoding="Windows-1252" ?^> echo ^<prtg^> echo ^<result^> echo ^<channel^>SFC Result^</channel^> echo ^<value^>%errorlevel%^</value^> echo ^<LimitErrorMsg^>Repair OS Health^</LimitErrorMsg^> echo ^</result^> echo ^</prtg^>
Add comment