Printer Installation/Print Test Page
Currently I am using the following to install a printer and print a test page.
I start the procedure with install.bat which moves the driver files, installation script and print test page script to a temp directory, calls the installation, resets the print spooler and then calls for a test page to be printed.
install.bat
PrintInstall.vbs
printTestPage.vbs
I eventually want to move this all into one script, and will hopefully get a chance to work on that soon and bug you guys, but my main question has to do with the Printing of the Test Page. This script works perfectly on every Canon and HP printer I have used it for so far. However, when I try to install a Kyocera, such as the one in the example above I get the else pop-up of "The test page could not be printed." The printer installs perfectly, and I can print a test page from the properties of the printer.
Does anyone know of a different method to attempt calling for a test page to print?
I start the procedure with install.bat which moves the driver files, installation script and print test page script to a temp directory, calls the installation, resets the print spooler and then calls for a test page to be printed.
install.bat
::copy driver files and scripts to temp directory
robocopy PrintInstall %temp%\PrintInstall *.* /E
::install printer driver
call "%temp%\PrintInstall\PrintInstall.vbs
::restart print spooler service
net stop spooler && net start spooler
::print test page
call "%temp%\PrintInstall\printTestPage.vbs
::cleanup installation files
rmdir "%temp%\PrintInstall" /S /Y
PrintInstall.vbs
strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
set objNewPort = objWMIService.get("Win32_TCPIPPrinterPort").SpawnInstance_
Set objPrinter = objWMIService.Get("Win32_Printer").SpawnInstance_
objWMIService.Security_.Privileges.AddAsString "SeLoadDriverPrivilege", True
Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "Kyocera TASKalfa 420i" 'Driver name in INF file
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
objDriver.FilePath = "C:\\PrintInstall\\Driver\\" 'Path to inf file
objDriver.Infname = "C:\\PrintInstall\\Driver\\OEMSETUP.INF" 'Path and name if inf file
intResult = objDriver.AddPrinterDriver(objDriver)
'Installs Printer Port
objNewPort.Name = "192.168.60.185" 'change to the port address or name
objNewPort.Protocol = 1
objNewPort.HostAddress = "192.168.60.185" 'change to the port address or name
objNewPort.PortNumber = 9100 'Change to appropriate port number if needed
objNewPort.SNMPEnabled = True
objNewPort.Put_
'Install Printer
objPrinter.DriverName = "Kyocera TASKalfa 420i" 'change to match the driver name in the INF same as first line above
objPrinter.PortName = "192.168.60.185" 'change to the port address or name
objPrinter.DeviceID = "Marietta - Kyocera TaskAlfa 420i KX" 'Friendly name displayed in control panel
objPrinter.Location = ""
objPrinter.Default = 1
objPrinter.Network = True
objPrinter.Put_
printTestPage.vbs
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colPrinters = objWMIService.ExecQuery _
("Select * from Win32_Printer Where DeviceID = 'Marietta - Kyocera TaskAlfa 420i KX'")
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
I eventually want to move this all into one script, and will hopefully get a chance to work on that soon and bug you guys, but my main question has to do with the Printing of the Test Page. This script works perfectly on every Canon and HP printer I have used it for so far. However, when I try to install a Kyocera, such as the one in the example above I get the else pop-up of "The test page could not be printed." The printer installs perfectly, and I can print a test page from the properties of the printer.
Does anyone know of a different method to attempt calling for a test page to print?
0 Comments
[ + ] Show comments
Answers (1)
Please log in to answer
Posted by:
package_aligator
13 years ago
Try using Prnqctl.vbs, should be located in "System32\Printing_Admin_Scripts".
http://technet.microsoft.com/en-us/library/bb490976.aspx
http://technet.microsoft.com/en-us/library/bb490976.aspx
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.