mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-15 10:28:55 +01:00
Merge branch 'master' of https://github.com/fleschutz/PowerShell
This commit is contained in:
commit
aef9527491
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists all jobs of all printers
|
||||
Lists all print jobs
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists all print jobs of all printer devices.
|
||||
.EXAMPLE
|
||||
@ -14,18 +14,22 @@
|
||||
#Requires -Version 4
|
||||
|
||||
try {
|
||||
$printers = Get-Printer
|
||||
if ($printers.Count -eq 0) { throw "No printer found" }
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
$printers = Get-Printer
|
||||
if ($printers.Count -eq 0) { throw "No printer found" }
|
||||
|
||||
""
|
||||
"Printer Jobs"
|
||||
"------- ----"
|
||||
foreach ($printer in $printers) {
|
||||
$printjobs = Get-PrintJob -PrinterObject $printer
|
||||
if ($printjobs.Count -eq 0) {
|
||||
"$($printer.Name) none"
|
||||
} else {
|
||||
"$($printer.Name) $printjobs"
|
||||
""
|
||||
"Printer Jobs"
|
||||
"------- ----"
|
||||
foreach ($printer in $printers) {
|
||||
$printjobs = Get-PrintJob -PrinterObject $printer
|
||||
if ($printjobs.Count -eq 0) {
|
||||
"$($printer.Name) none"
|
||||
} else {
|
||||
"$($printer.Name) $printjobs"
|
||||
}
|
||||
}
|
||||
}
|
||||
exit 0 # success
|
||||
|
@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists all printers known to the local computer
|
||||
Lists the printers
|
||||
.DESCRIPTION
|
||||
This PowerShell script lists all printers known to the local computer.
|
||||
.EXAMPLE
|
||||
@ -12,8 +12,12 @@
|
||||
#>
|
||||
|
||||
try {
|
||||
$ComputerName = $(hostname)
|
||||
get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | format-table
|
||||
if ($IsLinux) {
|
||||
# TODO
|
||||
} else {
|
||||
$ComputerName = $(hostname)
|
||||
Get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | Format-Table
|
||||
}
|
||||
exit 0 # success
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user