Solved

Utility to get printer serial number

Posted on 2013-05-16
13
5,605 Views
Last Modified: 2016-11-12
I'm looking for a VBScript or any other utility available to get the serial number of Lexmark printers.

I already have this little script that gives me other details of a specific printer
Dim objWMIService, objItem, colItems, strComputer

strComputer ="??????"
strprinter = InputBox("Enter Printer Name")
If strprinter = "" Then
   wscript.quit
End If
Printer = "%" & ucase(strprinter) & "%"

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Printer where Name like '" & printer & "' and Local=TRUE",,48)

For Each objItem In colItems
WScript.Echo objItem.name & VbCr & _
"========================" & VbCr & _
"Availability: " & objItem.Availability & VbCr & _
"Description: " & objItem.Description & VbCr & _
"Printer: " & objItem.DeviceID & VbCr & _
"Driver Name: " & objItem.DriverName & VbCr & _
"Port Name: " & objItem.PortName & VbCr & _
"Printer State: " & objItem.PrinterState & VbCr & _
"Printer Status: " & objItem.PrinterStatus & VbCr & _
"PrintJobDataType: " & objItem.PrintJobDataType & VbCr & _
"Print Processor: " & objItem.PrintProcessor & VbCr & _
"Spool Enabled: " & objItem.SpoolEnabled & VbCr & _
"Separator File: " & objItem.SeparatorFile & VbCr & _
"Queued: " & objItem.Queued & VbCr & _
"Status: " & objItem.Status & VbCr & _
"StatusInfo: " & objItem.StatusInfo & VbCr & _
"Published: " & objItem.Published & VbCr & _
"Shared: " & objItem.Shared & VbCr & _
"ShareName: " & objItem.ShareName & VbCr & _
"Direct: " & objItem.Direct & VbCr & _
"Location: " & objItem.Location & VbCr & _
"Priority: " & objItem.Priority & VbCr & _
"Work Offline: " & objItem.WorkOffline & VbCr & _
"Horizontal Res: " & objItem.HorizontalResolution & VbCr & _
"Vertical Res: " & objItem.VerticalResolution & VbCr & _
""
Next

WScript.Quit
0
Comment
Question by:Bianchi928
  • 4
  • 4
  • 2
  • +3
13 Comments
 
LVL 46

Expert Comment

by:Martin Liss
ID: 39173059
I doubt if something like that is available.
0
 
LVL 1

Expert Comment

by:TXSolution79
ID: 39173094
If the printer has http web interface utility start their.
0
 

Author Comment

by:Bianchi928
ID: 39173119
Yes it does have...But how do I extract this info. I don't want to be going like http://10.??.??.?? for each single printer.
0
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 46

Expert Comment

by:Martin Liss
ID: 39173148
I said I doubted if the serial number is available because there's no need for the OS to know about it. That's different from the other information you've gathered which concerns the printer's functionality or its state which the OS does need to know about.
0
 
LVL 7

Expert Comment

by:eerwalters
ID: 39173182
3 easier options than looking at each one manually

       1- Write your own SNMP utility to grab the data

       2- Use MarkVision Professional or Enterprise if you have a total LexMark shop.  You can export the scan results from that utility
           http://www1.lexmark.com/en_CA/software/markvision

       3- Use HP WebJetAdmin if you have a mixture of HP and LexMark.  Just realize that the serial # info gathered for the LexMark printers will vary depending on Make/Model.  You can export the results from this utility too.
          http://h20331.www2.hp.com/hpsub/cache/332262-0-0-225-121.html?jumpid=ex_r2845_go/webjetadmin/gc121306
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 39173427
What kind(s) of printers are they?  I did a fairly involved BAT script a while back to collect data from printers via SNMP, maybe that could be adapted.  Check out:

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24909017.html

~bp
0
 

Author Comment

by:Bianchi928
ID: 39173441
Most of the printers are Lexmark T650n.

I've have a look at your link and come back to you

Thanks
Cheers
0
 

Author Comment

by:Bianchi928
ID: 39173489
hp,

I had a look at the link..There are so many examples.   which one you reckon I should use to run a test on

Thanks
Cheers
0
 
LVL 53

Accepted Solution

by:
Bill Prew earned 300 total points
ID: 39173561
Let's try a little test.  Here's a BAT script to run as a test that will try and get just the serial number.  Save it as a bat and edit the IP line to be the printer IP.

You will also need the attached utility file in the folder you run the BAT from.  Download it and rename to an EXE file.

@echo off
setlocal EnableDelayedExpansion
setlocal EnableExtensions

set IP=1.2.3.4

REM Get Serial
call :DoSnmpGet "%IP%" ".1.3.6.1.4.1.11.2.3.9.4.2.1.1.3.3.0" "Serial"
REM If no serial found, try the XEROX MIB to see if it responds
if "!Serial!"=="N/A" (
  call :DoSnmpGet "%IP%" ".1.3.6.1.2.1.43.5.1.1.17.1" "Serial"
  REM If no serial found, try the RICOH MIB to see if it responds
  if "!Serial!"=="N/A" (
    call :DoSnmpGet "%IP%" ".1.3.6.1.4.1.367.3.2.1.2.1.4.0" "Serial"
    if NOT "!Serial!"=="N/A" (
      for /F "tokens=1 delims=," %%z in (!Serial!) do set Serial=%%z
      set Serial=!Serial:"=!
    )
  ) else (
    for /F "tokens=1 delims=," %%z in (!Serial!) do set Serial=%%z
    set Serial=!Serial:"=!
  )
)

echo Serial=%Serial%

exit /b

:DoSnmpGet
  REM Use SNMPGET to fetch value for IP and MIB passed in, return in variable passed in
  set %~3=N/A
  for /F "tokens=1-3*" %%t in ('snmpget -O T -v 1 -c public %~1 %~2 2^>nul^|find "="') do (
    set SnmpgetResult=%%w
    if "%%v"=="Hex-STRING:" (
      set SnmpgetResult=!SnmpgetResult: =!
      for /F "tokens=2 delims=[.]" %%z in ("!SnmpgetResult!") do set SnmpgetResult=%%z
    )
    set %~3=!SnmpgetResult!
  )
  exit /b

Open in new window

~bp
snmpget.txt
1
 

Author Closing Comment

by:Bianchi928
ID: 39173625
Works fine. Exactly what I wanted . Points are yours.
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 39173636
Thanks, glad that hekped.

~bp
0
 

Expert Comment

by:Muhammad Basir
ID: 41875892
hi Bill Prew
may i get the exe file for windows 64 bit  ?

Thanks in advance
Basir
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 41884945
I didn't create that utility, but a link to the site is below, take a look there for current versions and support info.

~bp
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question