I have in multiple machines tomcat app I would like through a script to automatically stop the tomcats of every server without connecting to every machine that means to launch from my local machine the script and stop-start the tomcats application of different servers.
All the servers have Windows server 2008 OS.
e.g. stop service, wait 10 secs, start it again.
sc \\servername stop "Service Name"
ping 127.0.0.1 -n 10
sc \\servername start "Service Name"
sc \\severname query "Service Name"
The Service name is the one shown in a list from sc query and may not match what you see in services GUI.
If you have a handful of machines you can just list the commands, or do it as a subroutine for each, or read from a text file, e.g.
Open in new window