B
BSmith2277
I have a working printer install script, but I am lacking the ability
to define Printer Trays.
So, I still need to touch the desktop to define what tray prints to
what kind of paper.
I understand that each printer driver have different tray
configurations.
I am working with HP LaserJet 42xx series printers.
The trays available to me are:
1. Automatically Select
2. Printer Auto Select
3. Manual Feed in Tray1
4. Tray1
5. Tray2
6. Tray3
In the following example, how would I code the script to define the
correct Printer Tray?
<job id="Add_WORK-Hun1">
<script language="VBscript">
dim r
r = MsgBox("This script will install the WORK-HunU printer to
your
computer." & vbCrLf & _
" on TCP/IP port 10.252.11.18. To continue, Press
OK.",VbOKCancel,"Install WORK-Hun1 Printer")
If r = vbCancel Then WScript.Quit
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_10.252.11.18"
objNewPort.Protocol = 1
objNewPort.HostAddress = "10.252.11.18"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "HP LaserJet 4250 PCL 6"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
errResult = objDriver.AddPrinterDriver(objDriver)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root
\cimv2")
Set objPrinter =
objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "HP LaserJet 4250 PCL 6"
objPrinter.PortName = "IP_10.252.11.18"
objPrinter.DeviceID = "WORK-HunU"
objPrinter.Network = False
objPrinter.Shared = False
objPrinter.Put_
</script>
</job>
to define Printer Trays.
So, I still need to touch the desktop to define what tray prints to
what kind of paper.
I understand that each printer driver have different tray
configurations.
I am working with HP LaserJet 42xx series printers.
The trays available to me are:
1. Automatically Select
2. Printer Auto Select
3. Manual Feed in Tray1
4. Tray1
5. Tray2
6. Tray3
In the following example, how would I code the script to define the
correct Printer Tray?
<job id="Add_WORK-Hun1">
<script language="VBscript">
dim r
r = MsgBox("This script will install the WORK-HunU printer to
your
computer." & vbCrLf & _
" on TCP/IP port 10.252.11.18. To continue, Press
OK.",VbOKCancel,"Install WORK-Hun1 Printer")
If r = vbCancel Then WScript.Quit
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_10.252.11.18"
objNewPort.Protocol = 1
objNewPort.HostAddress = "10.252.11.18"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
Set objDriver = objWMIService.Get("Win32_PrinterDriver")
objDriver.Name = "HP LaserJet 4250 PCL 6"
objDriver.SupportedPlatform = "Windows NT x86"
objDriver.Version = "3"
errResult = objDriver.AddPrinterDriver(objDriver)
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root
\cimv2")
Set objPrinter =
objWMIService.Get("Win32_Printer").SpawnInstance_
objPrinter.DriverName = "HP LaserJet 4250 PCL 6"
objPrinter.PortName = "IP_10.252.11.18"
objPrinter.DeviceID = "WORK-HunU"
objPrinter.Network = False
objPrinter.Shared = False
objPrinter.Put_
</script>
</job>