Quite late to the party, but...
This should work at least for HP Office Jet (tested with HP Office Jet 4500). I don't have access to any other models but I can imagine that it works for any network-managed (HP) printer.
@echo off
setlocal
for /f %%a in ('curl "http://192.168.0.000/index.htm?cat=info&page=printerInfo#" 2^>nul ^|findstr /rc:" *CN"') do set "SN=%%a"
echo Serialnumber is %SN%.
This depends on the printer to be manufactured in China (Serial number starts with CN...
The question explicitly asks for a cmd
solution. With any language with proper HTML or REGEX support, there are surely better (safer) solutions (not depending on CN...
).
Also, the curl
command might be subject to improvement (first time I used it)
the relevant section in the HTML looks like:
<tr>
<td class="info">
Product Serial Number
</td>
<td>
CN000A000A00AA
</td>
</tr>
I extracted the link to the info page from curl <printer-ip>
, which gave me
<body onLoad="window.top.location.href='./index.htm?cat=info&page=printerInfo'">
(which surely can be used to get the correct page with different models)
(Note: curl
is now available with WIN 10, so this probably won't have worked back in 2014 "out of the box")