diff --git a/Data/scripts.csv b/Data/scripts.csv index 5b7281df..ce6017d2 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -34,6 +34,7 @@ list-earthquakes.ps1, lists earthquakes with magnitude >= 6.0 for the last 30 da list-modules.ps1, lists the PowerShell modules list-news.ps1, lists the latest news list-os-releases.ps1, lists OS releases and download URL +list-printers.ps1, lists all printer known to the computer list-processes.ps1, lists the local computer processes list-random-passwords.ps1, prints a list of random passwords list-random-pins.ps1, prints a list of random PIN's diff --git a/README.md b/README.md index abed46bf..e020db83 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol * [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules * [list-news.ps1](Scripts/list-news.ps1) - lists the latest news * [list-os-releases.ps1](Scripts/list-os-releases.ps1) - lists OS releases and download URL +* [list-printers.ps1](Scripts/list-printers.ps1) - lists all printer known to the computer * [list-processes.ps1](Scripts/list-processes.ps1) - lists the local computer processes * [list-random-passwords.ps1](Scripts/list-random-passwords.ps1) - prints a list of random passwords * [list-random-pins.ps1](Scripts/list-random-pins.ps1) - prints a list of random PIN's diff --git a/Scripts/list-printers.ps1 b/Scripts/list-printers.ps1 new file mode 100644 index 00000000..26a5e456 --- /dev/null +++ b/Scripts/list-printers.ps1 @@ -0,0 +1,16 @@ +#!/snap/bin/powershell +<# +.SYNTAX ./list-printers.ps1 +.DESCRIPTION lists all printer known to the computer +.LINK https://github.com/fleschutz/PowerShell +.NOTES Author: Markus Fleschutz / License: CC0 +#> + +try { + $ComputerName = $(hostname) + get-WMIObject -Class Win32_Printer -ComputerName $ComputerName | format-table + exit 0 +} catch { + write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}