Merge branch 'develop' of https://github.com/silversword411/tacticalrmm into develop

This commit is contained in:
silversword411
2021-12-13 22:07:02 -05:00
2 changed files with 38 additions and 0 deletions

View File

@@ -360,6 +360,16 @@
"shell": "powershell",
"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",
"filename": "Win_Defender_Enable.ps1",

View 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
}
}
}
}