mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-08 09:04:18 +01:00
Add list-print-jobs.ps1
This commit is contained in:
parent
fd991223b0
commit
04b7ac59dc
@ -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.
|
@ -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
28
Scripts/list-print-jobs.ps1
Executable 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user