getting the printer serial number programmatically

Dear All,

I am trying to find out the serial number for a
printer(local or network), programmatically, in
Windows NT.

Actually I thought that using DeviceIOControl will get
me that, but after getting handle(through CreateFile)
for the printer, I am not able to find any IOCTL for
this purpose.

Can u suggest, that am i going in the right direction,
if yes then can u please suggest what IOCTL should I
use, and if not then is there any other better method.

Thanks & regards
Pankaj


Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com

There is no standard way of getting the serial number from a printer.

To get the serial number you need a bidi-connection to the printer. Then
depending on the printer, you have to use a managment language like SNMP,
TIP/SI, PML, PJL or simmilar. And evnen if the printer has bidi support, it
might not be possible.

For network printers (at least the newer models) you can use SNMP. For other
printers it is a major task, and requires indepth knowledge on various
printer communication and managment protocols, models and often undocumented
commands.


Christoph Lindemann
Undocumented Printing
http://undocprint.printassociates.com/

-----Original Message-----
From: Pankaj Adlakha [mailto:xxxxx@yahoo.co.in]
Sent: Tuesday, April 25, 2006 10:56 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] getting the printer serial number programmatically

Dear All,

I am trying to find out the serial number for a
printer(local or network), programmatically, in
Windows NT.

Actually I thought that using DeviceIOControl will get
me that, but after getting handle(through CreateFile)
for the printer, I am not able to find any IOCTL for
this purpose.

Can u suggest, that am i going in the right direction,
if yes then can u please suggest what IOCTL should I
use, and if not then is there any other better method.

Thanks & regards
Pankaj


Yahoo! India Matrimony: Find your partner now. Go to
http://yahoo.shaadi.com


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

> I am trying to find out the serial number for a

printer(local or network), programmatically, in

I think that this is impossible in a vendor-compatible way. Serial number for,
say, Epson has nothing to do with serial number for HP, and I will not be
suprised if some printers have no software-accessible serial numbers at all.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

[For Maxim]
If in some printers it might be the case, that serial
number is not accessible, then it is a cause of
concern.
Actually my aim is to get an unique identifier for a
printer. The purpose is that i have to monitor in my
application, the installation of printers, and in that
it is to be looked after that whether the same printer
is being reinstalled or not.
So, that unique identifier should remain the same
between installations. First I thought that this could
be acheived by mac address, but that doesn’t hold for
local printers. Then I started investigating the
serial number.
Now, since the case is that serial number accesibility
may or may not be there, so this option too seems to
be closed, so can you suggest some other unique
identifier for printer.

[For Christoph]
Is this the only way I can get the serial number,
actually, it looks that it will take some time, and
according to my project duration I don’t have so much
time. But, if suppose this is the only way, then i
will definitely go for it.

— “Maxim S. Shatskih”
wrote:

> > I am trying to find out the serial number for a
> > printer(local or network), programmatically, in
>
> I think that this is impossible in a
> vendor-compatible way. Serial number for,
> say, Epson has nothing to do with serial number for
> HP, and I will not be
> suprised if some printers have no
> software-accessible serial numbers at all.
>
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR
> Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

__________________________________________________________
Yahoo! India Matrimony: Find your partner now. Go to http://yahoo.shaadi.com



If in some printers it might be the case, that serial number is not accessible, then it is a cause of concern.


[/quote]


Dude… there’s nothing that even guarantees you that printers are capable of two way communication, never mind that they can report their serial number in some non-vendor specific manner.

The only non-vendor specific way I know to determine the serial number of a printer is to look on the printer itself. In my experience, this works for both local and network printers. Of course, you’re responsible for interpreting the serial number regardless of its form… including if the numerals are written in Farsi.

Good luck,

Peter
OSR

Hi Pankaj,

As is often the case with hardware you don’t control, you have to come
up with some alternative that typically implements multiple solutions.
For example, you might do the following:

  1. If supports MAC address, store the mac address (with a tag indicating
    this is a mac address).

  2. If supports S/N (and the S/N are unique, which isn’t always the case
    for hardware), then store the serial number (with a tag indicating it’s
    a serial number). Don’t interpret the raw bytes, just store for
    comparison.

  3. If supports <>,
    save the raw data with tag for that method.

    4) Store the Windows PNP unique ID as above with a tag also.

    Then, use a hueristic method to match new printers. It gets tricky when
    you realize that some printers can connect via USB, Parallel, and
    optionally ethernet. However, you should be able to find something
    “good enough”, even if its ugly.

    .

    -----Original Message-----
    From: Pankaj Adlakha [mailto:xxxxx@yahoo.co.in]
    Sent: Wednesday, April 26, 2006 3:40 AM
    Subject: Re: getting the printer serial number programmatically

    [For Maxim]
    If in some printers it might be the case, that serial number is not
    accessible, then it is a cause of concern.
    Actually my aim is to get an unique identifier for a printer. The
    purpose is that i have to monitor in my application, the installation of
    printers, and in that it is to be looked after that whether the same
    printer is being reinstalled or not.
    So, that unique identifier should remain the same between installations.
    First I thought that this could be acheived by mac address, but that
    doesn’t hold for local printers. Then I started investigating the serial
    number.
    Now, since the case is that serial number accesibility may or may not be
    there, so this option too seems to be closed, so can you suggest some
    other unique identifier for printer.

    [For Christoph]
    Is this the only way I can get the serial number, actually, it looks
    that it will take some time, and according to my project duration I
    don’t have so much time. But, if suppose this is the only way, then i
    will definitely go for it.

    — “Maxim S. Shatskih”
    wrote:

    > > I am trying to find out the serial number for a printer(local or
    > > network), programmatically, in
    >
    > I think that this is impossible in a
    > vendor-compatible way. Serial number for, say, Epson has nothing to do

    > with serial number for HP, and I will not be suprised if some printers

    > have no software-accessible serial numbers at all.
    >
    > Maxim Shatskih, Windows DDK MVP
    > StorageCraft Corporation
    > xxxxx@storagecraft.com
    > http://www.storagecraft.com
    >
    >
    > —
    > Questions? First check the Kernel Driver FAQ at
    > http://www.osronline.com/article.cfm?id=256
    >
    > To unsubscribe, visit the List Server section of OSR Online at
    > http://www.osronline.com/page.cfm?name=ListServer
    >

    __________________________________________________________
    Yahoo! India Matrimony: Find your partner now. Go to
    http://yahoo.shaadi.com

>4) Store the Windows PNP unique ID as above with a tag also.

Yes, BTW, this solves the task for USB printers.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com