Update list-printers.ps1

This commit is contained in:
Markus Fleschutz 2022-12-04 10:46:19 +01:00
parent 6df3796258
commit 37a7468559

View File

@ -1,6 +1,6 @@
<# <#
.SYNOPSIS .SYNOPSIS
Lists all printers known to the local computer Lists the printers
.DESCRIPTION .DESCRIPTION
This PowerShell script lists all printers known to the local computer. This PowerShell script lists all printers known to the local computer.
.EXAMPLE .EXAMPLE
@ -12,8 +12,12 @@
#> #>
try { try {
if ($IsLinux) {
# TODO
} else {
$ComputerName = $(hostname) $ComputerName = $(hostname)
get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | format-table Get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | Format-Table
}
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"