Check Windows Service Status And Restart If Necessary
Share
Lately we have been noticing an issue where the Print Spooler service stops for some reason and users are unable to print UBE results through EnterpriseOne. So far, we have been unable to narrow down a cause for the Spooler service to stop.
So, like any good CNC Admin, I put a band-aid on it. I found a bat file script that I could use to check the status of the service and then restart the service it it wasn’t running. I then setup a scheduled task to run every 5 minutes.
ECHO OFF for /F "tokens=3 delims=: " %%H in ('sc query "Spooler" ^| findstr " STATE"') do ( ECHO STATE = %%H if /I "%%H" NEQ "RUNNING" ( REM Put your code you want to execute here REM For example, the following line net start "Spooler" ECHO Spooler has been restarted ) )
Do you have any band-aids that you use to mitigate issues?
Author
Stewart Schatz
More Stories
How to Print a Directory Structure Using PowerShell: Step-by-Step Guide
If you need to print out the directory structure and list the files within, this PowerShell script will help you...
Quick Tip: Determine Active Directory Account Status From The Windows Commandline
Use the following command to Determine Active Directory Account Status from the Windows Commandline without Powershell or any special software....
Windows God Mode… What!?!
Windows God Mode is a hidden feature in the Windows operating system that allows users to access all of the system’s control panel options and settings in a single place.
How To Test A SQL Server Connection
There is an easy way to test your SQL Server connection when running Windows without any special software. I found...
4 Lines To Export Outlook Rules To Excel/CSV Using PowerShell
I used to use a ton of Outlook Rules to organize the thousands of emails that I receive each day....
Get The Size & Record Count Of All Tables In A SQL Server Database
Use the SQL query below to display the size and record count of all tables in an SQL Server database....
Average Rating