Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

Print the status page with a script

Hi,

I have to take a print out of the status page every day.Is there a way i can print the status page of all the printers with a bat file.

Regards
Sharath
Avatar of Alan Huseyin Kayahan
Alan Huseyin Kayahan
Flag of Sweden image

      Hi Sharath

<SCRIPT LANGUAGE = "VBScript">
Sub window_onLoad
 GetInfo
 iTimerID = window.setInterval("GetInfo", 60000, "VBScript")
End Sub
Sub GetInfo
 For i = (objTable.Rows.Length - 1) to 0 Step -1
 myNewRow = Document.All.objTable.deleteRow(i)
 Next
 Set objRow = objTableBody.InsertRow()
 objRow.Style.fontWeight = "bold"
 Set objCell = objRow.InsertCell()
 objCell.InnerText = "Name"
 Set objCell = objRow.InsertCell()
 objCell.InnerText = "Location"
 Set objCell = objRow.InsertCell()
 objCell.InnerText = "Status"
 strComputer = "."
 Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & _
 strComputer & "\root\cimv2")
 Set colPrinters = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_Printer")
 For Each objPrinter in colPrinters
 Set objRow = objTableBody.InsertRow()
 Set objCell = objRow.InsertCell()
 objCell.InnerText = objPrinter.Name
 Set objCell = objRow.InsertCell()
 objCell.InnerText = objPrinter.Location
 Set objCell = objRow.InsertCell()
 Select Case objPrinter.PrinterStatus
 Case 1
 strPrinterStatus = "Other"
 Case 2
 strPrinterStatus = "Unknown"
 Case 3
 strPrinterStatus = "Idle"
 Case 4
 strPrinterStatus = "Printing"
 Case 5
 strPrinterStatus = "Warming up"
 End Select
 objCell.InnerText = strPrinterStatus
 Next
End Sub
</SCRIPT>
<TABLE ID = "objTable" border = "1" >
<TBODY ID = "objTableBody">
</TBODY>
</TABLE>

Regards
Avatar of bsharath

ASKER

I get this error.

---------------------------
Windows Script Host
---------------------------
Script:      C:\Printer status page.vbs
Line:      46
Char:      1
Error:      Expected statement
Code:      800A0400
Source:       Microsoft VBScript compilation error

---------------------------
OK  
---------------------------
         Above script is for viewing in web page. Any time you doubkle-click it, you can view the status of all, then ctrl+p to print
Apply Following commands and post results.
Also confirm me does it show any dialog box or prints the page directly.

Click Start -> Run -> Cmd.exe
WMIC Printer "PrinterName" Call PrintTestPage
                               ^---------------------------------------- put the printer name here.




I get this.

C:\>WMIC Printer "HC-2F" Call PrintTestPage
No Instance(s) Available.
What i want is the status page not test page.I want to get the pagecount page for filing them.
Sorry mate, I don't think this can be done easily with a script (or at least not in my knowledge). If the printers are HTTP enabled then you can get the statistics/ page count report through web browser (http://PrinterIPAddress) or visit printers vendor site for such software.
Hi bsarath,

Pretty near everything for printer ability via scripting is here.

http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/printing/servers/

However I agree with farankazi, in that Im pretty sure you can not get the printers page count/statistics directly via a script.


I would say tho that If these are in fact jetdirect printers that you can access via a browser I see no reason why you couldnt script a web request to the printer and then parse the resulting page/data you need from what is returned.



zf
Maybe way off the deep end, but the thought of a packet capture during the HP status moniter server side and see what the request for update to the printer looks like is not completly out of order here either.  But am siding with parsing an http request.  I would try it out but no jetdirect printers here.  If its still open for the next few days Ill try to put something together at work with the http parsing.



zf
Any help....
Any help....
Hi bsharath, are these jetdirect network printers?

I have just finished a script that will remotely query a jetdirect printer and save the status page returned to an html file on the local machine the script is run from.  If these are jetdirect printers this should work for you.

zf
zoofan

i dont know if they are jet direct printers.How do i find it.
They are network printers and i have a windows 2003 print server.
Open a web browser and type in the IP address of one of the printers, If they are jetdirect and open you should be able to see the HP status page.

http://192.168.0.254    <--- replace with printer IP.


zf
If you dont know the IP and it is infact netowrked,  go into your printers properties and look at the ports tab.  the ip for the port will be there.

zf
with the ip address i am able to see the status page of the printer.

I chedck all my 20 printers i am able to see the web page
A way to print all the printers status page to 1 printer near me...?
k,  this will save a status page 192_168_0_1.html to your local hdd, that done.  Give me a few and Ill see if I can get it auto print to your default printer as well.

zf
Ok thanks waiting for this script.This will save 30 min every day for 1 Engineer to pick each status page from each printer.....
Copy and paste into printstatus.vbs  and run with printer IP as parameter.

Filename         space   IPaddress
printstatus.vbs 192.168.0.0


'===Start copy: printstatus.vbs===
' ---------------------------------------------------------------'
' printstatus.vbs
' 'Sample VBScript to query remote printer
' 'and retieve/print status page.
' ''Author Riley C. aka ZooFan
' '''Version 4.1 - August 2007
' ''''https://www.experts-exchange.com question ID: 22726732
' ---------------------------------------------------------------'
'
Option Explicit      
      Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
      Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
      Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
      Dim sCurPath 'Current Path of Script
      Dim strTempFile 'Name of temp file created and deleted by script
      Dim objWshShell 'Create object for Scripting Shell
      Dim objFso ' Create file system Object for WScript
      Dim strGetPage 'The page we want from the web
      Dim objIndexPage 'Object for reading
      Dim objReadIndex 'Object for reading
      Dim intLneCount '
      Dim strFilesaved 'The page returned from the GET
      Dim strArgReplace
      Dim strCommand
'Set up Common Objects
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
     
'Set Variables
      sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      strGetPage = "http://" & WScript.Arguments(0)
      strArgReplace = Replace(WScript.Arguments(0),".","_")
      strTempFile = sCurPath & "\" &  strArgReplace &".html"
      strCommand = "RUNDLL32.EXE MSHTML.DLL,PrintHTML " & strTempFile
'Test to see if our temp file exists if so delete it
      If objFso.FileExists(strTempFile) Then
            objFso.deleteFile(strTempFile)
      End If
'Get the file from the site
Call GetPage(strGetPage, strTempFile)
'Read the file into Array
            Set objIndexPage = objFso.GetFile(strTempFile)
            Set objReadIndex = objIndexPage.OpenAsTextStream(ForReading, TristateUseDefault)
                  Do Until objReadIndex.AtEndOfStream
                        ReDim Preserve arrRegValues(intLneCount)
                        arrRegValues(intLneCount) = objReadIndex.ReadLine
                        intLneCount = intLneCount + 1
                  Loop
            objReadIndex.Close
            objWshShell.Run strCommand, 0, True
            objFso.DeleteFile(strTempFile)
            Wscript.Quit
Function  GetPage(address, strFilesaved)
Dim DataBin
Dim HTTPGET
Dim server
Set HTTPGET = CreateObject("Msxml2.ServerXMLHTTP.6.0")
HTTPGET.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
HTTPGET.Open "GET", address, False
HTTPGET.Send
DataBin = HTTPGET.ResponseBody
Const adTypeBinary=1
Const adSaveCreateOverWrite=2
Dim SendBinary
Set SendBinary = CreateObject("ADODB.Stream")
SendBinary.Type = adTypeBinary
SendBinary.Open
SendBinary.Write DataBin
SendBinary.SaveToFile strFilesaved, adSaveCreateOverWrite
End Function
Wscript.Quit      
'==END COPY==


let me know if you any trouble.

zf
Oh,  depending on your OS you may need to install Windows Installer V3 for the XML6

http://www.microsoft.com/downloads/details.aspx?familyid=889482FC-5F56-4A38-B838-DE776FD4138C&displaylang=en




zf
I am running this from Win 2003.I get no error nor any results.Am i missing any thing.

hmmm,  you are using teh printer ip in the command line correct?

try this as it may be a printing issue.


'===Start copy: printstatus.vbs===
' ---------------------------------------------------------------'
' printstatus.vbs
' 'Sample VBScript to query remote printer
' 'and retieve/print status page.
' ''Author Riley C. aka ZooFan
' '''Version 4.1 - August 2007
' ''''https://www.experts-exchange.com question ID: 22726732
' ---------------------------------------------------------------'
'
Option Explicit      
      Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
      Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
      Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
      Dim sCurPath 'Current Path of Script
      Dim strTempFile 'Name of temp file created and deleted by script
      Dim objWshShell 'Create object for Scripting Shell
      Dim objFso ' Create file system Object for WScript
      Dim strGetPage 'The page we want from the web
      Dim objIndexPage 'Object for reading
      Dim objReadIndex 'Object for reading
      Dim intLneCount '
      Dim strFilesaved 'The page returned from the GET
      Dim strArgReplace
      Dim strCommand
'Set up Common Objects
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
     
'Set Variables
      sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      strGetPage = "http://" & WScript.Arguments(0)
      strArgReplace = Replace(WScript.Arguments(0),".","_")
      strTempFile = sCurPath & "\" &  strArgReplace &".html"
      strCommand = "RUNDLL32.EXE MSHTML.DLL,PrintHTML " & strTempFile
'Test to see if our temp file exists if so delete it
      If objFso.FileExists(strTempFile) Then
            objFso.deleteFile(strTempFile)
      End If
'Get the file from the site
Call GetPage(strGetPage, strTempFile)
'Read the file into Array
            Set objIndexPage = objFso.GetFile(strTempFile)
            Set objReadIndex = objIndexPage.OpenAsTextStream(ForReading, TristateUseDefault)
                  Do Until objReadIndex.AtEndOfStream
                        ReDim Preserve arrRegValues(intLneCount)
                        arrRegValues(intLneCount) = objReadIndex.ReadLine
                        intLneCount = intLneCount + 1
                  Loop
            objReadIndex.Close
            objWshShell.Run strCommand, 0, True
            Wscript.Quit
Function  GetPage(address, strFilesaved)
Dim DataBin
Dim HTTPGET
Dim server
Set HTTPGET = CreateObject("Msxml2.ServerXMLHTTP.6.0")
HTTPGET.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
HTTPGET.Open "GET", address, False
HTTPGET.Send
DataBin = HTTPGET.ResponseBody
Const adTypeBinary=1
Const adSaveCreateOverWrite=2
Dim SendBinary
Set SendBinary = CreateObject("ADODB.Stream")
SendBinary.Type = adTypeBinary
SendBinary.Open
SendBinary.Write DataBin
SendBinary.SaveToFile strFilesaved, adSaveCreateOverWrite
End Function
Wscript.Quit      
'==END COPY==


after you run it look in the directory where you have the script and tell me if you see the html file.

zf
Does the second script save the html file?  The first one deletes it after printing I removed the delete line as I think it is just a print issue.


zf
Ok I figured out what was wrong, will repost in a sec.

zf
Was hidding the shell out so it wouldnt open the print dialog box :-( sorry!!

'===Start copy: printstatus.vbs===
' ---------------------------------------------------------------'
' printstatus.vbs
' 'Sample VBScript to query remote printer
' 'and retieve/print status page.
' ''Author Riley C. aka ZooFan
' '''Version 4.3 - August 2007
' ''''https://www.experts-exchange.com question ID: 22726732
' ---------------------------------------------------------------'
'
Option Explicit      
      Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
      Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
      Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
      Dim sCurPath 'Current Path of Script
      Dim strTempFile 'Name of temp file created and deleted by script
      Dim objWshShell 'Create object for Scripting Shell
      Dim objFso ' Create file system Object for WScript
      Dim strGetPage 'The page we want from the web
      Dim objIndexPage 'Object for reading
      Dim objReadIndex 'Object for reading
      Dim intLneCount '
      Dim strFilesaved 'The page returned from the GET
      Dim strArgReplace
      Dim strCommand
'Set up Common Objects
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
     
'Set Variables
      sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      strGetPage = "http://" & WScript.Arguments(0)
      strArgReplace = Replace(WScript.Arguments(0),".","_")
      strTempFile = sCurPath & "\" &  strArgReplace &".html"
      strCommand = "RUNDLL32.EXE MSHTML.DLL,PrintHTML " & strTempFile
'Test to see if our temp file exists if so delete it
      If objFso.FileExists(strTempFile) Then
            objFso.deleteFile(strTempFile)
      End If
'Get the file from the site
Call GetPage(strGetPage, strTempFile)
'Read the file into Array
            Set objIndexPage = objFso.GetFile(strTempFile)
            Set objReadIndex = objIndexPage.OpenAsTextStream(ForReading, TristateUseDefault)
                  Do Until objReadIndex.AtEndOfStream
                        ReDim Preserve arrRegValues(intLneCount)
                        arrRegValues(intLneCount) = objReadIndex.ReadLine
                        intLneCount = intLneCount + 1
                  Loop
            objReadIndex.Close
            objWshShell.Run strCommand,1,true
            Wscript.Quit
Function  GetPage(address, strFilesaved)
Dim DataBin
Dim HTTPGET
Dim server
Set HTTPGET = CreateObject("Msxml2.ServerXMLHTTP")
HTTPGET.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
HTTPGET.Open "GET", address, False
HTTPGET.Send
DataBin = HTTPGET.ResponseBody
Const adTypeBinary=1
Const adSaveCreateOverWrite=2
Dim SendBinary
Set SendBinary = CreateObject("ADODB.Stream")
SendBinary.Type = adTypeBinary
SendBinary.Open
SendBinary.Write DataBin
SendBinary.SaveToFile strFilesaved, adSaveCreateOverWrite
End Function
Wscript.Quit      
'==END COPY==
Found another typo,  sorry must be time for sleep.......


'===Start copy: printstatus.vbs===
' ---------------------------------------------------------------'
' printstatus.vbs
' 'Sample VBScript to query remote printer
' 'and retieve/print status page.
' ''Author Riley C. aka ZooFan
' '''Version 4.3 - August 2007
' ''''https://www.experts-exchange.com question ID: 22726732
' ---------------------------------------------------------------'
'
Option Explicit      
      Const ForReading = 1, ForWriting = 2, ForAppending = 3 'FileObject Access Type
      Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 'FileObject Format Type
      Const SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS = 13056
      Dim sCurPath 'Current Path of Script
      Dim strTempFile 'Name of temp file created and deleted by script
      Dim objWshShell 'Create object for Scripting Shell
      Dim objFso ' Create file system Object for WScript
      Dim strGetPage 'The page we want from the web
      Dim objIndexPage 'Object for reading
      Dim objReadIndex 'Object for reading
      Dim intLneCount '
      Dim strFilesaved 'The page returned from the GET
      Dim strArgReplace
      Dim strCommand
'Set up Common Objects
      Set objFso = CreateObject("Scripting.FileSystemObject")
      Set objWshShell = WScript.CreateObject("WScript.Shell")
     
'Set Variables
      sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
      strGetPage = "http://" & WScript.Arguments(0)
      strArgReplace = Replace(WScript.Arguments(0),".","_")
      strTempFile = sCurPath & "\" &  strArgReplace &".html"
      strCommand = "RUNDLL32.EXE MSHTML.DLL,PrintHTML " & strTempFile
'Test to see if our temp file exists if so delete it
      If objFso.FileExists(strTempFile) Then
            objFso.deleteFile(strTempFile)
      End If
'Get the file from the site
Call GetPage(strGetPage, strTempFile)
'Read the file into Array
            Set objIndexPage = objFso.GetFile(strTempFile)
            Set objReadIndex = objIndexPage.OpenAsTextStream(ForReading, TristateUseDefault)
                  Do Until objReadIndex.AtEndOfStream
                        ReDim Preserve arrRegValues(intLneCount)
                        arrRegValues(intLneCount) = objReadIndex.ReadLine
                        intLneCount = intLneCount + 1
                  Loop
            objReadIndex.Close
            objWshShell.Run strCommand,1,true
            objFso.DeleteFile(strTempFile)
            Wscript.Quit
Function  GetPage(address, strFilesaved)
Dim DataBin
Dim HTTPGET
Dim server
Set HTTPGET = CreateObject("Msxml2.ServerXMLHTTP.6.0")
HTTPGET.setOption(2) = SXH_SERVER_CERT_IGNORE_ALL_SERVER_ERRORS
HTTPGET.Open "GET", address, False
HTTPGET.Send
DataBin = HTTPGET.ResponseBody
Const adTypeBinary=1
Const adSaveCreateOverWrite=2
Dim SendBinary
Set SendBinary = CreateObject("ADODB.Stream")
SendBinary.Type = adTypeBinary
SendBinary.Open
SendBinary.Write DataBin
SendBinary.SaveToFile strFilesaved, adSaveCreateOverWrite
End Function
Wscript.Quit      
'==END COPY==



zf
What will happen when i run this.
Script name ip address.?
Will it save a file or print to the printer.
Should i specify the printer it needs to print all the status pages?
it will print them, and should ask you for the printer to print to.  It will delete the temp file after the print.  If you have problems printing or want to keep the files add a ' and comment out the

   objFso.DeleteFile(strTempFile)

line then it will not delete the files and just leave them in the directory the script is in.


zf
each file will be named by printer IP

192_158_0_0.html


zf
There are 2 lines in the script
objFso.DeleteFile(strTempFile)
I commented both .There is a html file which is created but .There is no contents in it.....
sorry only the second should be commented out

            objWshShell.Run strCommand,1,true
            'objFso.DeleteFile(strTempFile)
            Wscript.Quit


this one.


zd
did you have to enter a password when you opened the printer ip ina browser?


zf
No it never asked me for a password.
It just opened blank
I get this.

 Internet Explorer cannot display the webpage
   
   Most likely causes:
You are not connected to the Internet.
The website is encountering problems.
There might be a typing error in the address.
 
   What you can try:
     Check your Internet connection. Try visiting another website to make sure you are connected.  
 
     Retype the address.  
 
     Go back to the previous page.
 
     More information

This problem can be caused by a variety of issues, including:

Internet connectivity has been lost.
The website is temporarily unavailable.
The Domain Name Server (DNS) is not reachable.
The Domain Name Server (DNS) does not have a listing for the website's domain.
If this is an HTTPS (secure) address, click tools, click Internet Options, click Advanced, and check to be sure the SSL and TLS protocols are enabled under the security section.

For offline users

You can still view subscribed feeds and some recently viewed webpages.
To view subscribed feeds

Click the Favorites Center button , click Feeds, and then click the feed you want to view.

To view recently visited webpages (might not work on all pages)

Click Tools , and then click Work Offline.
Click the Favorites Center button , click History, and then click the page you want to view.

 
when you put the ip pf the printer in a browser you get a blank page?

Im not talking about the file,  nor with the password,  am talking about directly connecting to the printer


zf
your post "with the ip address i am able to see the status page of the printer.

I chedck all my 20 printers i am able to see the web page"


did you enter a password to view this?


zf
When i put this ip on the ie
http://129.40.185.54/

I can see the ststus page of that printer without any password.It just opens....
No i never put any password.It just opens...
ok and when you pass the ip to the script your doing it as IP only correct>?

no http://


just  129.40.185.54

zf
and no chance you saved this password on an earlier access?


this worked on all 9 of my HP's 4000-8100  without issue.  so not really sure whats up


zf
Yes i am specifing only the ip address no Http

I checked with many printer all the printers just create a file but no content in it...
Have to goto work will recheck it again and get back with you a bit


zf
Ok thanks
WHEN I TRIED SCRIPTNAME  WITH HTTP:\\IPADDRESS I GOT THIS.

---------------------------
Windows Script Host
---------------------------
Script:      C:\printstatus.vbs
Line:      61
Char:      1
Error:      A connection with the server could not be established

Code:      80072EFD
Source:       msxml6.dll

---------------------------
OK  
---------------------------
Hi, the http is added in the script, made it easier to deal with the file name.  So when you add it in the parameter what your connecting to becomes http://http://ipaddress.   hence the error.  What type of printers do you have?  I tested this on a hp inkjet that is networked and found that the status page is all java and resulted in a blank page saved.

zf
Retested @ work on a HP4050 and it returned a blank page.  The status page on that printer is a java script result so Im thinking this maybe whats happening on your end.  Now that I have one returning the same results you have I will rework this and try to resolve it.  Back later.

zf
Have uploaded a VB project with source files and compiled exe,  vbscripting does not support printing web pages in any sort of reasonable fashion.  Nor can it deal with the frame pages.  Try this out and let me know.

Modify the printers.txt and put your printer ips in the list(take mine out) run the app and click "autorun"

https://filedb.experts-exchange.com/incoming/ee-stuff/4285-printstatus.zip

zf
zoofan

This is  excellent stuff. When i give a load and print .Where will it print?. Will it print all in 1 printer.Small change can you make the screen which is being shown as big as possible to fit screen.
It will print to your windows default printer, and yes all will print to the same.  Will make it larger gimmie a few minutes.

zf
Can i given give the prints to the relevent printers.Some time i would require to give it to the related printers.An button which can do this please...
I am not understanding this at all
"Can i given give the prints to the relevent printers.Some time i would require to give it to the related printers.An button which can do this please..."


and no I have not worked on
https://www.experts-exchange.com/questions/22731874/Terminal-server-Scripting.html
  yet have been very busy with work the last week.


Is a bit of a tall order for a single question, no?



zf
ASKER CERTIFIED SOLUTION
Avatar of zoofan
zoofan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry.

"Can i given give the prints to the relevent printers.Some time i would require to give it to the related printers.An button which can do this please..."


What i mean is you have made the script in such a way that all the prints of the status page comes to one printer.If possible can i even have a option to give individual prints to the individual printers as some time i would need to check the printer quality....


And regarding this Q.

https://www.experts-exchange.com/questions/22731874/Terminal-server-Scripting.html

Please help when ever possible with the possible points covered please....

An error has occured in the script on this page

Line 1829
char  1
error  unspecified error.

When i give a auto run all i get the above error...
That error is being generated by the printer not the app, first off this isnt a script, it is, second there isnt 1829 lines of code in it :-)  but there is in the status page.  Only thign that changed between first project and second project is the resize of the browser control period.  If that occurs when you first click autorun, remove the first or second printer from your text file and retry.


There is no way that I am aware of for this app to print to a printer that you do not have installed,  It is possiable to script a test page to any printers that are installed and shared on a print server(windows pc, NOT jetdirect) but a list of all share names is required.  That is not what this app was written to do tho and a different process all together.

zf
Am testing this to see if I can get it incorperated into the app,  uses telnet to send a page to a remote printer via tcp/ip

Telnet can be used to transfer data to the HP Jetdirect device. This should be used only for testing since it is not an HP-supported method of printing. Telnet porting may differ in the variety of operating systems that include telnet as an application. One of the following examples should work:

    *

      telnet TCP/IP address 9100 < filename

    *

      cat filename | telnet TCP/IP address 9100

    *

      telnet TCP/IP address 9100

Then type something and end the telnet session; what was typed should print

type a CTRL ] to end the telnet connection, and then type "quit" to end telnet. Another way to terminate the telnet connection is CTRL Z. If you are using a text file for a test, the control characters CTRL M, and then CTRL ] can be appended to the end of the text file. This will end the telnet session, as well as the 9100 socket connection


Ill let ya know.

zf
Oh the script to print the test page to a PC based print server

strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colPrinters =  objWMIService.ExecQuery _
    ("Select * from Win32_Printer Where DeviceID = '\\\\atl-ps-01\\color-printer'")

For Each objPrinter in colPrinters
    errReturn = objPrinter.PrintTestPage
    If errReturn = 0 Then
        Wscript.Echo "The test page was printed successfully."
    Else
        Wscript.Echo "The test page could not be printed."
    End If
Next


From  http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0407.mspx




zf
If you would like some help modifing that to work with a text file list of print server shares post it.

zf
zoofan

i use this way to print multiple test pages on its individual printers.

rundll32 printui.dll,PrintUIEntry /k /n "\\dev-chen-srv10\Hc-GF"
rundll32 printui.dll,PrintUIEntry /k /n "\\dev-chen-srv10\Hc-1F"
rundll32 printui.dll,PrintUIEntry /k /n "\\dev-chen-srv10\Hc-2F"
rundll32 printui.dll,PrintUIEntry /k /n "\\dev-chen-srv10\Hc-3F"
rundll32 printui.dll,PrintUIEntry /k /n "\\dev-chen-srv10\Hc-4F"
ok cool.

zf