Monday, April 06, 2009

Set Printer Share Comment to the Port Name

We use an asset tag naming system to target all of our printer ports to the physical printers. The queue names are abstracted from the actual printer it's self. All of the printers have a DNS name that is their asset tag plus the SCCM site code of the location that they're currently located in. The only problem with this is that it creates a bunch of extra clicking to determine what printer a queue is actually pointed to (okay, so its like 4 extra clicks to get the port name, but its still tedious). The work around we came up with is to set the comment tag on the printer to the port name of the printer. To do that we use the following bit of PowerShell code that runs on an hourly basis on the server. It was tested on Windows Server 2008, but should work just fine on Server 2003:

$printers = Get-WMIObject -Class "Win32_Printer" -NameSpace "root\cimv2" -computername "."
ForEach($printer in $printers){
$printer.Comment = $printer.PortName
$printer.Put()
}

1 comment:

printer resetter said...

nice post,