script to restart print spooler service

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
  End If
End If

7 thoughts on “script to restart print spooler service

  1. Pingback: How To Fix Powershell Restart Service Print Spooler in Windows

  2. Pingback: How To Fix Restart Print Spooler Service Script in Windows

  3. 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


  4. 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 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.