Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users
:: ================ :: READ THIS FIRST :: ================ :: * To run this script you must have domain administrators rights. :: * This script require "Computers.txt" file from where it will pick computer names. :: * You need to add service names inside the script :: * Successful run will generate "ServiceStatusRpt.txt" :: * Copy and Paste following script into notepad and save it with any name having .cmd extension. :: Batch Script Start @ECHO OFF SETLOCAL EnableDelayedExpansion :: Add Service Names Here with prefix ECHO ( ECHO Sophos Agent ECHO SAVservice ECHO Sophos Device Control Service ECHO Sophos AutoUpdate Service)>SvcName.txt IF NOT EXIST Computers.txt Goto ShowErr FOR %%R IN (Computers.txt) Do IF %%~zR EQU 0 Goto ShowErr IF EXIST ServiceStatusRpt.txt DEL /F /Q ServiceStatusRpt.txt ECHO Machine Name:Sophos Agent:SAVService:Sophos Device Control Service:Sohpos AutoUpdate Service>ServiceStatusRpt.txt FOR /F %%c IN ('Type Computers.txt') Do ( Echo Processing: %%c PING -n 1 -w 1000 %%c|Find /I "TTL" >NUL IF NOT ErrorLevel 1 ( Set Report=%%c: FOR /F "delims=*" %%s IN ('TYPE SvcName.txt') DO ( WMIC /NODE:"%%c" SERVICE WHERE "Name='%%s' AND State='Running'" GET Status 2>NUL |FIND /I "OK" >NUL IF NOT ERRORLEVEL 1 ( Set Report=!Report!Running: ) ELSE ( Set Report=!Report!NOT Running: ) ) ) ELSE ( Set Report=%%c: Not able to connect ) ECHO !Report:~0,-1!>>ServiceStatusRpt.txt ) Goto EndScript :ShowErr Echo "Computers.txt" file does not exist or file is empty! :EndScript IF EXIST SvcName.txt DEL /F /Q SvcName.txt ENDLOCAL EXIT /B 0 :: Batch Script End
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.