I wrote a script to pull printer name, serial number and page counts from our
printers. How can I save the results to a text file?
This is the script:
Model = "mib-2.43.5.1.1.16.1"
SerialNumber = "mib-2.43.5.1.1.17.1"
PageCount = "mib-2.43.10.2.1.4.1.1"
Host = "C:\testhost.txt"
Set objfso = CreateObject("Scripting.FileSystemObject")
Set exec = CreateObject("WScript.Shell")
Set hostw = objfso.OpenTextFile(host, 1, True)
Do Until hostw.AtEndOfStream
r = hostw.ReadLine
WScript.Echo "start here"
WScript.Echo r
Set Loger = exec.Exec("snmpwalk -v 1 -c public " & r & " " & Model)
b = Loger.stdout.readall
WScript.Echo Replace(b, "SNMPv2-SMI:: = STRING: "& Model,"")
Set Loger2 = exec.Exec("snmpwalk -v 1 -c public " & r & " " & SerialNumber)
b2 = Loger2.stdout.readall
WScript.Echo Replace(b2, "SNMPv2-SMI:: = STRING: "& SerialNumber,"")
Set Loger3 = exec.Exec("snmpwalk -v 1 -c public " & r & " " & PageCount)
b3 = Loger3.stdout.readall
WScript.Echo Replace(b3, "SNMPv2-SMI:: = counter32: "& PageCount,"")
Loop