Added list-printers.ps1

This commit is contained in:
Markus Fleschutz 2021-01-09 15:42:51 +01:00
parent 1232a12779
commit e0d576d662
3 changed files with 18 additions and 0 deletions

View File

@ -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

1 Filename Description
34 list-modules.ps1 lists the PowerShell modules
35 list-news.ps1 lists the latest news
36 list-os-releases.ps1 lists OS releases and download URL
37 list-printers.ps1 lists all printer known to the computer
38 list-processes.ps1 lists the local computer processes
39 list-random-passwords.ps1 prints a list of random passwords
40 list-random-pins.ps1 prints a list of random PIN's

View File

@ -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

16
Scripts/list-printers.ps1 Normal file
View File

@ -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
}