Change or update an HP Printer Serial Number

We have replaced a number of HP printer JetDirect system boards over the years.  One issue it took us a while to notice is that the serial number of the new board is ‘XXXXXXXXXX’.  This is probably supposed to be changed by the service technician, but what are you going to do…  This caused issues with reporting and monitoring since there was no longer any consistent way of tracking the hardware.  The MAC address changes as well and the IP address can change based on our environment.

Using Printer Control Language (PCL)

You can check your serial number like this (from Linux):

snmpget -v 1 -c <community> <ip address> SNMPv2-SMI::mib-



Using this Perl script, you can change the serial number to whatever you want (like what it was before the repair!):


# Connects to a JetDirect equipped HP printer and uses
# HP's control language to set the serial number.
# Takes an IP address and "SERIAL NUMBER" on the
# command line.

use strict;
use warnings;

unless (@ARGV) { print "usage: $0 <ip address> <SERIAL_NUMBER>\n" ; exit }

my $ipaddr = $ARGV[0];
my $sernum = $ARGV[1];
chomp $ipaddr;

use IO::Socket;
my $socket = IO::Socket::INET->new(
PeerAddr  => $ipaddr,
PeerPort  => "9100",
Proto     => "tcp",
Type      => SOCK_STREAM
) or die "Could not connect to $ipaddr: $!";

my $data = <<EOJ
\e%-12345X\@PJL SET SERIALNUMBER=$sernum

print $socket $data;


Changing page count (again, useful when a new system board is installed) is the same process but uses the ‘PAGES’ command instead of ‘SERIALNUMBER’.

Comments are closed.