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

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.

          cd\Windows\System32
          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:

cd\Windows\System32
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.
Kerry WilsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

n2fcCommented:
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gabriel CliftonNet AdminCommented:
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.
0
Kerry WilsonAuthor Commented:
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.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Kerry WilsonAuthor Commented:
Oh, I also tried the SysWOW64 version of the prnqctl.vbs file....same result.
0
Gabriel CliftonNet AdminCommented:
I understand you have admin rights, but did you try "Run As Administrator"
0
n2fcCommented:
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:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Q_24795160.html
0
Kerry WilsonAuthor Commented:
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.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows 7

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.