Advertisement
Advertisement
| 07.20.2008 at 09:59AM PDT, ID: 23580245 | Points: 500 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: |
PathToDLL = "\\whateverserver\whateverpath\PRNADMIN.DLL"
portloc = "1.1.1.1"
DriverName = "HP LaserJet IIISi"
PrintQueueName = "Printer Number 1"
set wshshell = wscript.createobject("wscript.shell")
set fso = createobject("scripting.filesystemobject")
fso.copyfile PathToDLL, "c:\Program Files\PRNADMIN.DLL", True
wshshell.run "regsvr32 /s ""c:\Program Files\PRNADMIN.DLL""", , True
wscript.sleep 1000
dim oPort
dim oMaster
set oPort = CreateObject("Port.Port.1")
set oMaster = CreateObject("PrintMaster.PrintMaster.1")
portinput = "IP_" & portloc
oPort.ServerName = ""
sPortExist = False
for each oPort in oMaster.Ports("")
if oPort.PortName = portinput then
sPortExist = True
End If
next
If sPortExist = False then
set oPort = CreateObject("Port.Port.1")
oPort.PortName = portinput
oPort.PortType = 1
oPort.HostAddress = portloc
oPort.PortNumber = 9100
oPort.SNMP = false
oMaster.PortAdd oPort
if Err <> 0 then
msgbox "an error occurred"
end if
End If
dim oPrinter
set oPrinter = CreateObject("Printer.Printer.1")
oPrinter.ServerName = ""
oPrinter.DriverPath = "C:\Printer\Driver\Ricoh MP7000"
oPrinter.InfFile = "C:\Printer\Driver\Ricoh MP7000\RC67E12K.inf"
oPrinter.PrinterName = PrintQueueName
oPrinter.DriverName = DriverName
oPrinter.PortName = portinput
oMaster.PrinterAdd oPrinter
if Err <> 0 then
msgbox "an error occurred"
set oport = nothing
set oPrinter = nothing
set oMaster = nothing
set wshshell = nothing
set fso = nothing
|