HP Universal Printer PCL 6 driver cannot read printer capabilities

This bug I encountered last week.

While writing a system to define printers and TCP/IP ports in bulk on Windows 2008 R2 servers, I got the report from the testers that a color printer defined with the HP Universal Printer PCL 6 driver wasn’t recognized as color when the port and printer were defined with my script.
In fact, it did not detect anything at all on the printer, the HP Universal Printer PCL 6 driver’s wizard wasn’t even activated when I selected “Update now” for “Automatic configuration” on the printer’s “Device Settings” tab. Instead, the properties dialog of the printer was removed and then re-displayed with the same black-and-white setting.

After an hour of thinking and experimenting, it turned out that it all came down to the port name:
My script generated the port names like “IP_x.x.x.x:RAW1”, as we still have some devices using ports 9101 and 9102, or even LPR queue names.
Apparently the driver decided that this was the same kind of name like “LPT1:”, and refused to work with it.

Solution: Get rid of the colon (:) in the port name, and presto: The printer was detected as a color device right at the moment of definition.

Conclusion: Don’t use colons in port names on Windows 2008 R2 with Universal Printer drivers.