Need help updating file location path...
Posted: 26 May 2013 20:11
I have the following script which checks for multiple running services on remote servers...
What I need is to do a loop at the end and run the same code for %server2% and then %server3%, and so on though all 6 server variables. I have tried to do a loop by adding 1 to the end of the variable but it will not work.
Any ideas???
Code: Select all
set server1=scrfaxp5
set server2=scrfaxp6
set server3=scrfaxp8
set server4=srrfaxp5
set server5=srrfaxp6
set server6=srrfaxp8
echo "Verifying services..."
echo.
echo "%server1%"
echo "RightFax Database Module" & sc \\%server1% query RFDB|findstr STATE & echo.
echo "RightFax DocTransport Module" & sc \\%server1% query RFDOCTRANS|findstr STATE & echo.
echo "RightFax E-mail Gateway Module" & sc \\%server1% query RFEMAIL|findstr STATE & echo.
echo "RightFax eTransport Module" & sc \\%server1% query RFMIME|findstr STATE & echo.
echo "RightFax Paging Server Module" & sc \\%server1% query RFPAGE|findstr STATE & echo.
echo "RightFax Integration Module" & sc \\%server1% query RFPROD|findstr STATE & echo.
echo "RightFax Queue Handler" & sc \\%server1% query RFQUEUE|findstr STATE & echo.
echo "RightFax Remoting Service" & sc \\%server1% query RFRemote|findstr STATE & echo.
echo "RightFax RPC Server Module" & sc \\%server1% query RFRPC|findstr STATE & echo.
echo "RightFax Server Module" & sc \\%server1% query RFSERVER|findstr STATE & echo.
echo "RightFax WorkServer1 Module" & sc \\%server1% query RFWORK1|findstr STATE & echo.
echo "RightFax WorkServer2 Module" & sc \\%server1% query RFWORK2|findstr STATE & echo.
echo "RightFax WorkServer3 Module" & sc \\%server1% query RFWORK3|findstr STATE & echo.
echo "RightFax WorkServer4 Module" & sc \\%server1% query RFWORK4|findstr STATE & echo.
echo "RightFax WorkServer5 Module" & sc \\%server1% query RFWORK5|findstr STATE & echo.
echo "Captaris Conversion Engine" & sc \\%server1% query RFIsoConv|findstr STATE & echo.
echo "Captaris Sync Module" & sc \\%server1% query CapaSync|findstr STATE & echo.
What I need is to do a loop at the end and run the same code for %server2% and then %server3%, and so on though all 6 server variables. I have tried to do a loop by adding 1 to the end of the variable but it will not work.
Any ideas???