PowerShell Quick Tip 02 – Printer Audit

Posted: 29/07/2010 in PowerShell

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s