![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| | |||||||
| | Vista - Printer info |
| |
| 12-02-2008 | #1 |
| | Printer info Is it possible to connect to a network printers and get information such as serial number and model? I have the queue name and IP, but I need to get some other info such as above. We have a mixture of many makes and models here and the HP tool is causing some network issues so that's not an option. Thanks. |
| My System Specs |
| 12-02-2008 | #2 |
| | Re: Printer info Dave wrote: Quote: > Is it possible to connect to a network printers and get information such as > serial number and model? I have the queue name and IP, but I need to get some > other info such as above. We have a mixture of many makes and models here and > the HP tool is causing some network issues so that's not an option. Thanks. example from Nate Rice: Function SNMPGET(vServer, vCommunityString, vOID) On Error Resume Next 'This function will return the data from an SNMP get from the specified 'server and the specified OID. The information will have to be parsed 'afterward. The info will be retuned as the string or variable "SNMPGET". 'This script is provided under the Creative Commons license located 'at http://creativecommons.org/licenses/by-nc/2.5/ . It may not 'be used for commercial purposes with out the expressed written consent 'of NateRice.com Const OpenAsDefault = -2 Const FailIfNotExist = 0 Const ForReading = 1 Set WshShell = CreateObject("WScript.Shell") 'Create filesystem objects sTemp = WshShell.ExpandEnvironmentStrings("%TEMP%") sTempFile = sTemp & "\runresult.tmp" 'Create working file string 'Run the SNMPGET command and save results to tmp file WshShell.Run "%comspec% /C " & vSNMPGetPath & "\snmpget -c " & _ vCommunityString & " -v 1 " & vServer & " " & vOID & " > " & _ sTempFile, 0, True 'Read tmp file for snmpget results Set oFSO = CreateObject("Scripting.FileSystemObject") Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist, _ OpenAsDefault) SNMPGET = fFile.Readline If InStr(SNMPGET, "STRING:") > 0 Then aSNMPGET = Split(SNMPGET, "STRING:") vTemp = Replace(Trim(aSNMPGET(1)), Chr(34), "") SNMPGET = vTemp ElseIf InStr(SNMPGET, "INTEGER:") > 0 Then aSNMPGET = Split(SNMPGET, "INTEGER:") vTemp = Trim(aSNMPGET(1)) vTemp = vTemp + 0 SNMPGET = vTemp ElseIf InStr(SNMPGET, "IpAddress:") > 0 Then aSNMPGET = Split(SNMPGET, "IpAddress:") vTemp = Trim(aSNMPGET(1)) SNMPGET = vTemp End If fFile.Close oFSO.DeleteFile (sTempFile) End Function -- / ) Regards, / /_________ _|__|__) Paul Weterings / (O_) http://www.servercare.nl __/ (O_) ____(O_) |
| My System Specs |
| 12-03-2008 | #3 |
| | Re: Printer info On Dec 2, 3:19*pm, Paul Weterings <Paul-nospam-@xxxxxx-dot-com> wrote: Quote: > Dave wrote: Quote: > > Is it possible to connect to a network printers and get information such as > > serial number and model? I have the queue name and IP, but I need to get some > > other info such as above. We have a mixture of many makes and models here and > > the HP tool is causing some network issues so that's not an option. Thanks. > use netsnmp and call that (snmpget) from vbscript > > example from Nate Rice: > > Function SNMPGET(vServer, vCommunityString, vOID) > * * *On Error Resume Next > > * * *'This function will return the data from an SNMP get from the > specified > * * *'server and the specified OID. The information will have to beparsed > * * *'afterward. The info will be retuned as the string or variable > "SNMPGET". > * * *'This script is provided under the Creative Commons license located > * * *'athttp://creativecommons.org/licenses/by-nc/2.5/. It may not > * * *'be used for commercial purposes with out the expressed written consent > * * *'of NateRice.com > > * * *Const OpenAsDefault = -2 > * * *Const FailIfNotExist = 0 > * * *Const ForReading = 1 > > * * *Set WshShell = CreateObject("WScript.Shell") 'Create filesystem objects > * * *sTemp = WshShell.ExpandEnvironmentStrings("%TEMP%") > * * *sTempFile = sTemp & "\runresult.tmp" 'Create working file string > > * * *'Run the SNMPGET command and save results to tmp file > * * *WshShell.Run "%comspec% /C " & vSNMPGetPath & "\snmpget -c " &_ > * * *vCommunityString & " -v 1 " & vServer & " " & vOID & " > " & _ > * * *sTempFile, 0, True > > * * *'Read tmp file for snmpget results > * * *Set oFSO = CreateObject("Scripting.FileSystemObject") > * * *Set fFile = oFSO.OpenTextFile(sTempFile, ForReading, FailIfNotExist, _ > * * *OpenAsDefault) > > * * *SNMPGET = fFile.Readline > > * * *If InStr(SNMPGET, "STRING:") > 0 Then > * * * * *aSNMPGET = Split(SNMPGET, "STRING:") > * * * * *vTemp = Replace(Trim(aSNMPGET(1)), Chr(34), "") > * * * * *SNMPGET = vTemp > * * *ElseIf InStr(SNMPGET, "INTEGER:") > 0 Then > * * * * *aSNMPGET = Split(SNMPGET, "INTEGER:") > * * * * *vTemp = Trim(aSNMPGET(1)) > * * * * *vTemp = vTemp + 0 > * * * * *SNMPGET = vTemp > * * *ElseIf InStr(SNMPGET, "IpAddress:") > 0 Then > * * * * *aSNMPGET = Split(SNMPGET, "IpAddress:") > * * * * *vTemp = Trim(aSNMPGET(1)) > * * * * *SNMPGET = vTemp > * * *End If > > * * *fFile.Close > * * *oFSO.DeleteFile (sTempFile) > > End Function > > -- > > * / ) *Regards, > / /_________ > * * * _|__|__) Paul Weterings > * * / (O_) * *http://www.servercare.nl > __/ *(O_) > ____(O_) Dim computername,objWMIService,colItems,objItem computername = "PUT_COMPUTERNAME_HERE" Set objWMIService = GetObject("winmgmts:\\" & computername & "\root \cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer",, 48) For Each objItem in colItems Select Case objItem.DetectedErrorState Case 4 ErrState = "Out of Paper" Case 5 ErrState = "Toner low" Case 6 ErrState = "Printing" Case 9 ErrState = "Offline" Case Else ErrState = objItem.DetectedErrorState End Select wscript.echo "Name:" & objItem.Name wscript.echo "Share Name:" & objItem.ShareName wscript.echo "Comment:" & objItem.Comment wscript.echo "Error State:" & ErrState wscript.echo "Driver name:" & objItem.DriverName wscript.echo "BIDI Enable:" & objItem.EnableBIDI wscript.echo "Job Count Since Last Reset:" & objItem.JobCountSinceLastReset wscript.echo "Location:" & objItem.Location wscript.echo "Port Name:" & objItem.PortName wscript.echo "Published:" & objItem.Published wscript.echo "Queued:" & objItem.Queued wscript.echo "Shared:" & objItem.Shared wscript.echo "Status:" & objItem.Status wscript.echo "============================================" Next Set colItems = nothing Set objWMIService = nothing Larry www.windowsadminscripts.com |
| My System Specs |
![]() |
| Thread Tools | |
| |
| Similar Threads for: Printer info | ||||
| Thread | Forum | |||
| w= cInt(left(info,inStr(info,"x") -1)) | VB Script | |||
| Directory printer: Video info | General Discussion | |||
| Please wait while the printer sends info. to Windows | Vista print fax & scan | |||
| How do I change the administrator info and the registration info?? | Vista account administration | |||
| Probs trying to use snmp to get info from printer | PowerShell | |||