Merge branch 'develop' of https://github.com/silversword411/tacticalrmm into develop
This commit is contained in:
@@ -360,6 +360,16 @@
|
|||||||
"shell": "powershell",
|
"shell": "powershell",
|
||||||
"category": "TRMM (Win):3rd Party Software"
|
"category": "TRMM (Win):3rd Party Software"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"guid": "a9d2a6c0-8afa-4d69-8faf-f83b49c11702",
|
||||||
|
"filename": "Win_Printer_Restart_Jobs.ps1",
|
||||||
|
"submittedBy": "https://github.com/bc24fl/",
|
||||||
|
"name": "Printers - Restarts stuck printer jobs.",
|
||||||
|
"description": "Cycles through each printer and restarts any jobs that are stuck with error status.",
|
||||||
|
"shell": "powershell",
|
||||||
|
"category": "TRMM (Win):Printing",
|
||||||
|
"default_timeout": "90"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"guid": "da51111c-aff6-4d87-9d76-0608e1f67fe5",
|
"guid": "da51111c-aff6-4d87-9d76-0608e1f67fe5",
|
||||||
"filename": "Win_Defender_Enable.ps1",
|
"filename": "Win_Defender_Enable.ps1",
|
||||||
|
|||||||
28
scripts/Win_Printer_Restart_Jobs.ps1
Normal file
28
scripts/Win_Printer_Restart_Jobs.ps1
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Restarts stuck printer jobs.
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Cycles through each printer and restarts any jobs that are stuck with error status.
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
Change Log
|
||||||
|
----------------------------------------------------------------------------------
|
||||||
|
V1.0 Initial Release by https://github.com/bc24fl/tacticalrmm-scripts/
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
$allPrinters = Get-Printer
|
||||||
|
foreach ($printer in $allPrinters) {
|
||||||
|
$printJobs = Get-PrintJob -PrinterName $($printer.Name)
|
||||||
|
if ($printJobs) {
|
||||||
|
foreach ($job in $printJobs) {
|
||||||
|
if ($job.JobStatus -match 'Error') {
|
||||||
|
$stuckPrinterName = $job.PrinterName
|
||||||
|
$stuckPrinterJob = $job.Id
|
||||||
|
Write-Host "Restarting Job Id $stuckPrinterJob on printer $stuckPrinterName"
|
||||||
|
Restart-PrintJob -InputObject $job
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user