Home » PowerShell » PowerShell Script to Restart Print Spooler Service

PowerShell Script to Restart Print Spooler Service

Sometimes, we have a problem with printer spooler where documents are getting stuck in the printer queue or printer spooler service is not running. To fix restart print spooler service issues, use PowerShell script to check if printer spooler service is running and restart print spooler service.

Powershell - Print job stucked in Printer queue
Powershell – Print job stucked in Printer queue

In the above image, 2 jobs are stuck/paused in Printer queue and failed to print.

In this blog post, I will explain you about how to fix issues related to printer spooler keeps stopping on windows using PowerShell script.

Fix Print Spooler Service Issue

If files are not being sent to printer or documents stuck in Printer queue, more common reason is Printer spooler service may not be running.

PowerShell Tip: Run PowerShell app or PowerShell ISE as administrator to restart Spooler service.

Print Spooler is the windows service name for print spooler. It is default enabled on all windows operating system and server OS. The main job of printer spooler service is to load print drivers, print jobs, queuing the jobs and handles the interaction with printer.

To check Printer spooler service status

Using below PowerShell script

$PrintSpooler = Get-Service -Name Spooler

# Get the Print Spooler Service status (Running or Stopped

In the above PowerShell script, using Get-Service cmdlet, get Spooler service object and assigned it to $PrintSpooler variable.

In next line, print the contents of $PrintSpooler variable. It output print spooler service Status, Name and Display name as below

PowerShell - Printer Spooler Service Status
PowerShell – Printer Spooler Service Status

PowerShell – Restart Print Spooler

$PrintSpooler = Get-Service -Name Spooler

# Get the Print Spooler Service status (Running or Stopped)

# Logic to check Print Spooler Service and restart if not running

if($PrintSpooler.Status -eq 'stopped')
    # Start Print Spooler Service on local computer
    Start-Service $PrintSpooler

# Check the Print Spool Service status 

In the above PowerShell script,

  • Get Spooler service object
  • Check Print Spooler Service Status
  • Check if print spooler service is in stopped status
  • If print spooler service is equal to stopped status, restart printer spooler service using Start-Service Spooler command

Cool Tip: How to get permissions on folders and subfolders!

How to Restart Printer Spooler Service on Workstation

# Get Spooler service object
$PrintSpooler = Get-Service -Name Spooler

#Restart Printer Spooler Service on WorkStation
Restart-Service $PrintSpooler

In the above PowerShell script,

  • Get Spooler Service object in $PrintSpooler variable
  • Using Restart-Service restart print Spooler service on Workstation

Cool Tip: Use test-connection to ping list of computers using PowerShell!

Clean Print Spooler Queue

It may happen that even after restart of printer spooler service, printer still not responding or files are not getting sent to printer.

To fix these issue, we need to take the backup of printer queue and later clean printer spooler queue.

PowerShell Tip: How to get printer properties in PowerShell!

Backup of Printer Spooler Queue Files

Before we clean printer spooler queue, take the backup of queue using below PowerShell script

# Stop Spooler Service
Stop-Service -Name Spooler -Force
# To backup the Spooler files
Move-Item -Path "$env:SystemRoot\System32\spool\PRINTERS\*.*" -Destination 'C:\Spooler\Backup\' -Force

In the above example, first stop print spooler service.

Using Move-Item and printer spool queue path, move the spool queue file to destination path as specified as backup.

Delete Printer Spooler Queue Files

As we took backup of queue files in the above steps, run below PowerShell script to delete spooler queue files and later start print spooler service.

# To delete the Printer Spooler files
Remove-Item -Path "$env:SystemRoot\System32\spool\PRINTERS\*.*"

# Start print spooler service
Start-Service -Name Spooler

In the above PowerShell script, Remove-Item cmdlet takes the printer spooler queue path specified with $env: path environment variable and delete all the files from the folders.

Cool Tip: How to using tail – to get last lines of files in PowerShell!


In the above post, I explained about how to restart print spooler service and use different PowerShell commands to fix the issues related to Printer spooler service not responding or printer spooler service is not in running status.

In such cases, you can restart print spooler service on local or remote workstation.

You can find more topics about PowerShell Active Directory commands and PowerShell basics on ShellGeek home page.

Leave a Comment