Announcement

Collapse
No announcement yet.

Script to print the test page to installed printers

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script to print the test page to installed printers

    Hi,

    I need help in creating a script to "Print Test Page" to all the printers installed in my computer.

    The printers' port is set to "File". The filename would be the name of the printer.

    Any help to accomplish this would be appreciated.

    Thank you

  • #2
    Re: Script to print the test page to installed printers

    any help would be appreciated

    Comment


    • #3
      Re: Script to print the test page to installed printers

      Not very difficult to do...

      Code:
      On Error Resume Next
      
      strComputer = "."
      Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
      Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_Printer")
      For Each objPrinter in colInstalledPrinters
          objPrinter.PrintTestPage
      Next
      This doesn't work in Windows 2000. If you have 2000 you'll have to know the DeviceID of the printer and use a batch script.

      Code:
      rundll32 printui.dll,PrintUIEntry /k /n "\\Sharename\Share"
      Andrew

      ** Remember to give credit where credit is due and leave reputation points sigpic where appropriate **

      Comment

      Working...
      X