question

seankudusi-5367 avatar image
0 Votes"
seankudusi-5367 asked seankudusi-5367 commented

VB script not working

Hi,

Thanks,

windows-10-general
· 5
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Before trying to print via code, have you tested a test print page using the control panel interface on the printer properties page?

0 Votes 0 ·

Hi,

Am able to give the print though ControlPanel->Device and Printers but not through script.

0 Votes 0 ·

I made a simple C++ app : EnumeratePrinters.zip
which also does a Test Page print
You can test it to check if you get the same error...


0 Votes 0 ·
Show more comments
GeorgeAziz-2769 avatar image
0 Votes"
GeorgeAziz-2769 answered

Hello,

Did you try to print a text file form a notepad before testing the code?
Is the installed driver is matching the printer model?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

ElevenYu-MSFT avatar image
0 Votes"
ElevenYu-MSFT answered seankudusi-5367 edited

Hi,

What's the type of the problematic printer?

Was the printer directly deployed on the machine that proceed the Test Print? Or was the printer installed on a printer server and shared to the machine you proceed Test Print?

And what's the OS version of this machine? Please run command "winver" to take a screenshot of the OS information.

Thanks,
Eleven

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Sean-Liming avatar image
1 Vote"
Sean-Liming answered seankudusi-5367 commented

Please post the script that you are using. From what you have shared, it doesn't look like it will work as you need to cycle through the printers available. A direct call will fail. Try the following code from this blog https://devblogs.microsoft.com/scripting/how-can-i-print-a-test-page-to-a-printer/

 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


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Invalid statement

0 Votes 0 ·

Are you sure you set the right printer name (and not the printer driver name) ?

0 Votes 0 ·

Yes i have given the Printer name only.

0 Votes 0 ·

Hello,

In your code can you try to send the print job the the printer IP instead of the printer name ?

0 Votes 0 ·
GeorgeAziz-2769 avatar image
0 Votes"
GeorgeAziz-2769 answered

Hello,

When you say I "configured/Install the printer using IP Address only", so I would like to be sure that is not an issue with the name resolution.

Are you able to resolve the printer name to IP ? so you are able to ping the printer using the printer name the printer name ?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

firasbadawi-2672 avatar image
0 Votes"
firasbadawi-2672 answered

install the canon printer driver updates

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.