I have around 140 virtual servers that need regular maintance, they all run message queuing, but the storage file needs to be kept below 512MB. I need to stop all the services in order and the last being MSMQ service, then go to the system32\msmg\storage file and delete all the *.mq files, once done I then would like the batch file to restart the services with the first being msmq. I also need to add some error messages, so if the service can not stop or start or its already running etc, below is what I think it should be like but not sure,. may be there is a better way of doing it, the plan would be to but the batch file on all the servers and set a sceduled task to Run the batch file. Would it be possible to have an email generated to say that it has been completed successfully ?
NET STOP AVLDataService 2>&1|FIND "2182"
IF errorlevel 1 goto :sub_already_stoped