mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-03-26 14:26:10 +01:00
Added list-printers.ps1
This commit is contained in:
parent
1232a12779
commit
e0d576d662
@ -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
|
||||
|
|
@ -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
16
Scripts/list-printers.ps1
Normal 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
|
||||
}
|
Loading…
Reference in New Issue
Block a user