I was asked to audit which printers were shared by a large group of Servers and here is a nice one liner I come up with that got me the information I needed:
First create an array with all your server host names e.g
$servers = 'SERVER01','SERVER02'
Then use the Get-WmiObject cmdlet as follows:
gwmi Win32_Printer -computername $servers -namespace root\CIMV2 | select __Server, DeviceID, DriverName
An example of the output:
__SERVER DeviceID DriverName -------- -------- ---------- SERVER01 SRV1P254 hp color LaserJet 2550 PCL 6 SERVER01 SRV1P004 RICOH Aficio MP C5000 PCL 5c SERVER01 SRV1P003 HP Color LaserJet 2600n SERVER01 SRV1P002 HP Color LaserJet 4700 PCL 6 SERVER01 SRV1P001 HP LaserJet 4100 PCL 6 SERVER01 Microsoft XPS Document Writer Microsoft XPS Document Writer SERVER01 CutePDF Writer CutePDF Writer SERVER02 Microsoft XPS Document Writer Microsoft XPS Document Writer SERVER02 SRVP254 hp color LaserJet 2550 PCL 6
Enjoy,
jfrmilner