Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Utility to get printer serial number

Posted on 2013-05-16
13
Medium Priority
?
7,107 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +3
13 Comments
 
LVL 49

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 49

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 58

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 58

Accepted Solution

by:
Bill Prew earned 1200 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 58

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 58

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

636 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