We have an order printing process utilizing a third party application that has registered Windows services to control the printing in the Warehouse. For unknown reasons these services randomly stop printing, even though the services are running. The fix is to just restart them. I have setup a scheduled task to restart them daily using the same Powershell script below, but what if someone needs to do them during the day, or when IT staff is unavailable, or???.
Create a batch file to do the same thing that any user can run!
Create your batch file like normal, and then use the following syntax to launch Powershell and run the command to restart services.
powershell.exe -command Restart-Service -InputObject $(Get-Service -Computer SERVERNAME -Name Service1,Service2,Service3);
NOTE: You need the semi-colon on the end of the line. If your script has multiple lines, you will need a semi colon at the end of each one.