I am trying to write a batch file that check to see if a service is running on multiple computers. I have the computers listed in a text file.
This doesn't see to work:
FOR /F "Tokens=*"%%L in (Computers.txt) DO
(
SET ComputerName=
SET ComputerName=%%L
SC.exe \\!ComputerName! Query ServiceIamChecking > Results.txt
)
Try: FOR /F "Tokens=*" %%L in (Computers.txt) DO SC.exe \\%%L Query ServiceIamChecking >> Results.txt
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |