Add list-print-jobs.ps1

This commit is contained in:
Markus Fleschutz 2021-08-30 11:37:36 +02:00
parent fd991223b0
commit 04b7ac59dc
3 changed files with 30 additions and 0 deletions

View File

@ -127,6 +127,7 @@ list-os-updates.ps1, lists operating system updates
list-passwords.ps1, prints a list of random passwords
list-pins.ps1, prints a list of random PIN's
list-printers.ps1, lists all printer known to the computer
list-print-jobs.ps1, lists all jobs of all printers
list-processes.ps1, lists the local computer processes
list-profiles.ps1, lists your PowerShell profiles
list-recycle-bin.ps1, lists the content of the recycle bin folder

Can't render this file because it has a wrong number of fields in line 86.

View File

@ -71,6 +71,7 @@ Mega Collection of PowerShell Scripts
| [list-installed-apps.ps1](Scripts/list-installed-apps.ps1) | Lists the installed Windows Store apps
| [list-installed-software.ps1](Scripts/list-installed-software.ps1) | Lists the installed software (except Windows Store apps)
| [list-printers.ps1](Scripts/list-printers.ps1) | Lists all printer known to the computer
| [list-print-jobs.ps1](Scripts/list-print-jobs.ps1) | Lists all jobs of all printers
| [list-processes.ps1](Scripts/list-processes.ps1) | Lists the local computer processes
| [list-services.ps1](Scripts/list-services.ps1) | Lists the services on the local computer
| [list-system-info.ps1](Scripts/list-system-info.ps1) | Lists system information on the local computer

28
Scripts/list-print-jobs.ps1 Executable file
View File

@ -0,0 +1,28 @@
#requires -version 4
<#
.SYNOPSIS
list-print-jobs.ps1
.DESCRIPTION
Lists all jobs from all printers
.EXAMPLE
PS> .\list-print-jobs.ps1
.NOTES
Author: Markus Fleschutz · License: CC0
.LINK
https://github.com/fleschutz/PowerShell
#>
try {
$printers = Get-Printer
if ($printers.Count -eq 0) { throw "No printer found" }
foreach ($printer in $printers) {
$printjobs = Get-PrintJob -PrinterObject $printer
"$printer"
"$printjobs"
}
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}