Powered by GeSHi

Source code for showprn.ps1

(view source code of showprn.ps1 as plain text)

  1. # WMI query to list all properties and values of the Win32_Printer class
  2. # This PowerShell script was generated using the WMI Code Generator, Version 1.30
  3. # http://www.robvanderwoude.com/updates/wmigen.html
  4.  
  5. param( [string]$strComputer = "." )
  6.  
  7. $colItems = get-wmiobject -class "Win32_Printer" -namespace "root\CIMV2" -computername $strComputer
  8.  
  9. foreach ($objItem in $colItems) {
  10. 	write-host "Name                           :" $objItem.Name
  11. 	write-host "Default                        :" $objItem.Default
  12. 	write-host "Network                        :" $objItem.Network
  13. 	write-host "Port Name                      :" $objItem.PortName
  14. 	write-host "Driver Name                    :" $objItem.DriverName
  15. 	write-host "Server Name                    :" $objItem.ServerName
  16. 	write-host "Share Name                     :" $objItem.ShareName
  17. 	write-host
  18. }
  19.