The below VB script can be used to restart print spooler service at regular intervals with Windows task scheduler.
'====================================== 'This script serves as a workaround to poorly written printer drivers ' 'It checks the spooler folder to see if there are any active jobs. 'If it is empty it will restart the spooler service. 'It works best as a regularly scheduled task. '====================================== Dim objFSO, objFolder Set objFSO = CreateObject("Scripting.FileSystemObject") Set objShell = CreateObject("WScript.Shell") If objFSO.FolderExists("C:\Windows\system32\spool\PRINTERS") Then Set objFolder = objFSO.GetFolder("C:\Windows\system32\spool\PRINTERS") If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then objShell.Run "Net Stop Spooler", 0, True objShell.Run "Net Start Spooler", 0, True Else End If End If
Excellent article! We will be linking to this great post on our site.
Keep up the great writing.
Pingback: How To Fix Powershell Restart Service Print Spooler in Windows
Pingback: How To Fix Restart Print Spooler Service Script in Windows
Thanks for this outstanding information.
Hi Pierre,
Yes it does work on Windows 2003. CPSVC is dependent on the Windows Print spooler so it will restart as well when you restart spooler service. hope it helps
Lal
Hi there, does it work on win 2k3? and what about citrix printing services? I’m looking to get all the spooler “associated” services like citrix print service to be restarted as well.
Thanks 🙂