В кошику порожньо!
net print \\server_name\printer_share To clear all jobs from a queue:
Import-Module PrintManagement Get-PrintJob -PrinterName "HP-LaserJet-4015" To see jobs across all printers:
Or using -ComputerName parameter where supported (limited in older cmdlets):
Get-PrintJob -ComputerName "WS-023" -PrinterName "Finance-Printer" | Remove-PrintJob A robust script includes error handling:
net stop spooler del /Q /F /S %systemroot%\System32\spool\PRINTERS\* net start spooler This deletes all pending print jobs regardless of printer or user. It is effective for clearing corrupted jobs that resist normal deletion but requires administrative privileges and disrupts all printers on the system. 6.1 Help Desk Script: Clear Stalled Queue param( [Parameter(Mandatory=$true)] [string]$PrinterName ) Write-Host "Clearing print queue for: $PrinterName" $jobs = Get-PrintJob -PrinterName $PrinterName if ($jobs.Count -eq 0) Write-Host "No jobs found." else Remove-PrintJob Write-Host "Removed $($jobs.Count) job(s)."
Get-Printer | Get-PrintJob Get-PrintJob -PrinterName "HP-LaserJet-4015" | Remove-PrintJob 4.4 Deleting a Specific Job by ID Remove-PrintJob -PrinterName "HP-LaserJet-4015" -JobId 7 4.5 Conditional Deletion Examples Delete jobs by document name pattern:
try Get-PrintJob -PrinterName "Missing-Printer" -ErrorAction Stop catch Write-Warning "Printer not found or inaccessible: $_"
net print \\server_name\printer_share To clear all jobs from a queue:
Import-Module PrintManagement Get-PrintJob -PrinterName "HP-LaserJet-4015" To see jobs across all printers: clear print queue cmd
Or using -ComputerName parameter where supported (limited in older cmdlets): net print \\server_name\printer_share To clear all jobs from
Get-PrintJob -ComputerName "WS-023" -PrinterName "Finance-Printer" | Remove-PrintJob A robust script includes error handling: clear print queue cmd
net stop spooler del /Q /F /S %systemroot%\System32\spool\PRINTERS\* net start spooler This deletes all pending print jobs regardless of printer or user. It is effective for clearing corrupted jobs that resist normal deletion but requires administrative privileges and disrupts all printers on the system. 6.1 Help Desk Script: Clear Stalled Queue param( [Parameter(Mandatory=$true)] [string]$PrinterName ) Write-Host "Clearing print queue for: $PrinterName" $jobs = Get-PrintJob -PrinterName $PrinterName if ($jobs.Count -eq 0) Write-Host "No jobs found." else Remove-PrintJob Write-Host "Removed $($jobs.Count) job(s)."
Get-Printer | Get-PrintJob Get-PrintJob -PrinterName "HP-LaserJet-4015" | Remove-PrintJob 4.4 Deleting a Specific Job by ID Remove-PrintJob -PrinterName "HP-LaserJet-4015" -JobId 7 4.5 Conditional Deletion Examples Delete jobs by document name pattern:
try Get-PrintJob -PrinterName "Missing-Printer" -ErrorAction Stop catch Write-Warning "Printer not found or inaccessible: $_"