⚡ PowerShell 5.1+
Get Printers Report
Queries Win32_Printer via WMI and reports Printers in a formatted table, with an optional CSV export.
Get-PrinterReport.ps1
<#
.SYNOPSIS
Reports Printers on this computer via WMI (Win32_Printer).
.DESCRIPTION
Queries Win32_Printer and displays Name, DriverName, PortName, PrinterStatus for each item found.
Use -ExportPath to also save the results to a CSV file.
.PARAMETER ExportPath
Optional path to a .csv file to write the results to.
.EXAMPLE
.\Get-PrinterReport.ps1
.EXAMPLE
.\Get-PrinterReport.ps1 -ExportPath C:\Reports\printer.csv
#>
[CmdletBinding()]
param(
[string]$ExportPath
)
$items = Get-CimInstance -ClassName Win32_Printer | Select-Object Name, DriverName, PortName, PrinterStatus
if (-not $items) {
Write-Host "No Printers found." -ForegroundColor Yellow
return
}
$items | Format-Table -AutoSize
if ($ExportPath) {
$items | Export-Csv -Path $ExportPath -NoTypeInformation -Encoding UTF8
Write-Host "`nExported to $ExportPath" -ForegroundColor Cyan
}