The following script demonstrates how to query NT Service Controller for service status. This script was used to check if the application (service) is running and if not install. msi package. Basic logging is also included.
You might need to find out service name. To do so issue the following cmd command to list all services:
sc query
—————————————————————————————————-
@echo ON
REM Created: Dec 08, 2009
REM Author: Naz Snidanko
REM Descrp: Query service and install .msi
SC QUERY Printelligence | FIND "STATE" > null
if %errorlevel% EQU 0 goto Good1
if %errorlevel% EQU 1 goto NotGood1
:Good1
goto DoNe
:NotGood1
echo %COMPUTERNAME% from %username% Deployment >> \\syslogserver\XEROX\log.txt
msiexec /i "\\zeus\Support\naz\script\xerox\Xerox Print Environment Assessor.msi"
echo Started %date% %time% >> \\syslogserver\XEROX\log.txt
:DoNe
——————————————————————————————
Hope it helps!
Many thanks for this fantastic publish. It contains many data which I will need. I am bookmark your website by my next visit.
Glad to help. I will try to publish more stuff I use at work.
Link exchange is nothing else however it is just placing the other person’s weblog link
on your page at suitable place and other person will also do
same in support of you.
Also visit my weblog watch chef
What’s up everyone, it’s my first visit at this site, and piece of writing is genuinely fruitful for
me, keep up posting such articles or reviews.
Here is my web blog; social landings (Lorene)