From 37a74685591854326575f6fadf9ca46a32df755e Mon Sep 17 00:00:00 2001 From: Markus Fleschutz <markus.fleschutz@gmail.com> Date: Sun, 4 Dec 2022 10:46:19 +0100 Subject: [PATCH 1/2] Update list-printers.ps1 --- Scripts/list-printers.ps1 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Scripts/list-printers.ps1 b/Scripts/list-printers.ps1 index b9b08d06..4af89bb5 100755 --- a/Scripts/list-printers.ps1 +++ b/Scripts/list-printers.ps1 @@ -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])" From e23add455f6579dacb311000dfcd6520e79199a1 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz <markus.fleschutz@gmail.com> Date: Sun, 4 Dec 2022 10:48:49 +0100 Subject: [PATCH 2/2] Update list-print-jobs.ps1 --- Scripts/list-print-jobs.ps1 | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Scripts/list-print-jobs.ps1 b/Scripts/list-print-jobs.ps1 index 773956c3..d25d3178 100755 --- a/Scripts/list-print-jobs.ps1 +++ b/Scripts/list-print-jobs.ps1 @@ -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