Monday, March 9, 2015

PowerShell - Print Queue

List Printers
Get-WMIObject -Class Win32_Printer | Select Name,DriverName,PortName,Shared,ShareName | ft -auto

Show Print Queue Status
Get-WMIObject Win32_PerfFormattedData_Spooler_PrintQueue | Select Name, @{Expression={$_.jobs};Label="CurrentJobs"}, TotalJobsPrinted, JobErrors

Delete a print queue (Ex: hp deskjet 960c series)
$p = Get-WmiObject -Class Win32_printer -filter "name='hp deskjet 960c series'"
$p.delete()