Kaseya Community

Restarting Service print spooler

  • I need to restart the print spooler can this be done with a script? If so can you give me a example please
    Thanks

    Legacy Forum Name: Restarting Service print spooler,
    Legacy Posted By Username: Bobbyh
  • Here's my script for restarting the SMTP service, just change the service name to whatever you want.

    Script Name: Restart SMTP Service
    Script Description: This script will restart the Microsoft SMTP service.

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : net stop smtpsvc
    Parameter 2 : 1
    OS Type : 0
    Execute Shell Command
    Parameter 1 : net start smtpsvc
    Parameter 2 : 1
    OS Type : 0
    ELSE


    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: kcears
  • you would want to do something like


    net stop spooler


    then


    net start spooler


    Here is a bit more advanced script for blowing a print queue away.


    Script Name: Clear Print Spool
    Script Description: This script stops the Spooler Service
    Deletes .SPL and .SHD files in C:\WINDOWS\system32\spool\PRINTERS then restarts the Spooler Service

    IF True
    THEN
    Execute Shell Command
    Parameter 1 : net stop spooler
    Parameter 2 : 0
    OS Type : 0
    Pause Script
    Parameter 1 : 5
    OS Type : 0
    Execute Shell Command
    Parameter 1 : del /F /Q C:\WINDOWS\system32\spool\PRINTERS\*.SHD
    Parameter 2 : 0
    OS Type : 0
    Execute Shell Command
    Parameter 1 : del /F /Q C:\WINDOWS\system32\spool\PRINTERS\*.SPL
    Parameter 2 : 0
    OS Type : 0
    Execute Shell Command
    Parameter 1 : net start spooler
    Parameter 2 : 0
    OS Type : 0
    ELSE


    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty
  • This should work great
    Later
    worked great
    New how do i close this post

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Bobbyh
  • This is exactly what we needed for one of our clients re: Adobe & HP Driver issues.. Here's hoping a scheduled task solves their problem!

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: dijikul
  • Keep in mind that you should check any services that are dependent upon the print spooler as well. "net stop X" prompts for confirmation for any service dependencies. Also, "net start X" won't start all of your dependencies back up.

    This is particularly true for Timberline, Citrix, etc.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: Intech-Jason
  • [QUOTE=Intech-Jason;61077]Keep in mind that you should check any services that are dependent upon the print spooler as well. "net stop X" prompts for confirmation for any service dependencies. Also, "net start X" won't start all of your dependencies back up.

    This is particularly true for Timberline, Citrix, etc.[/QUOTE]

    Yes... erm yeah... my posted script was not meant for citrix environments, it is also triggered by a monitor (for "automation") so be careful when deploying. We just recently had issues with a clients firey having long queues due to massive print jobs. A later version of the script adds user confirmation to delete the spooled jobs.

    Legacy Forum Name: Scripts Forum,
    Legacy Posted By Username: thirteentwenty