Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Printing Test Page from command line or batch file with Windows 7

Posted on 2014-08-07
Medium Priority
Last Modified: 2014-08-22
Okay,  I guess I'm among the millions worldwide who has been dragged away from XP kicking and screaming .

I don't do much printing with the printer in my office.  Many times I go for weeks without printing something and the inkjets get clogged/dried up.

With XP I had a simple two-line batch file that printed a test page on my printer.  I had it run on Mondays and Thursdays via the Task Scheduler.

          cscript prnqctl.vbs -e -p "EPSON Stylus C120 Series"

I have modified the batch file to the new path for prnqctl.vbs and the new printer name as follows:

cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnqctl.vbs -e -p "HP Officejet Pro 8100 (Kerry's office)"

I have also tried the SysWOW64 path to prnqctl.vbs file.

Both versions of the program fail with "Unable to get printer instance.  Error 0x8004103A Invalid object path"

I don't know where to go from here.
Question by:Kerry Wilson
  • 3
  • 2
  • 2
LVL 20

Accepted Solution

n2fc earned 1000 total points
ID: 40247091
1) This has to be run from an elevated command prompt   ("run as admin")

2) The printer name probably has a "comment" field added in (try removing the "(Kerry's office)" part
LVL 13

Assisted Solution

by:Gabriel Clifton
Gabriel Clifton earned 1000 total points
ID: 40247098
Ok, just tested with my system. The only problem is the ( ). I have tried escaping the (, but still got the same problem. Try removing the ( ) from the printer name and the script.

Author Comment

by:Kerry Wilson
ID: 40247129
I have admin rights as Domain Users are members of the Administrators Group.

However, progress has been made, I think.

As suggested I removed everything after the 8100 in both the printer name and in the script.  It still did not work but I got a different error.

"Failed Print Test Page Win32 error code 5"

So, I interpret this to mean it found the printer (object) this time but something else failed.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

by:Kerry Wilson
ID: 40247140
Oh, I also tried the SysWOW64 version of the prnqctl.vbs file....same result.
LVL 13

Expert Comment

by:Gabriel Clifton
ID: 40247155
I understand you have admin rights, but did you try "Run As Administrator"
LVL 20

Expert Comment

ID: 40247342
I did some additional testing...
1) The -m and -z commands (pause & resume) work fine...
2) It is only the -e (print test page) that fails...

It appears this is a file permissions issue!  You will need "write" permission to the \Windows\System32\spool folder to be allowed to do the print test page function!

See the following (previously answered) question:

Author Comment

by:Kerry Wilson
ID: 40279648
Well, I tried these suggestions.  I think you guys are on the right track.  But I have not found the "magic" solution.  It's still not working.  I'm going to forget it for now and close this thread as I don't have any more time to work on it.  I will just copy a page to the printer and forget about issuing a command to print a test page through the command line.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Rules and regulations were devised in order to maintain the integrity of a system. However, interpretation of rules can be quite tricky.
Choosing the right mix of apps is very much necessary for CPAs for making the most of the latest technology through which they can boost their growth.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

580 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