I created the attached script. It reads (Port name, IP address, Driver name,
Printer name, Share name, Location,
etc. ) from Excell and uses that information to create a bunch of printers
on a print server.
I created this on my test server (Win 2003 SP1) and it works fine.
I coppied the script and the Excell document to the actual Print Server,
also Win 2003 SP1 and when I run it, I get a VBScript Runtime error that
says "ActiveX component can't create object: 'PrintMaster.PrintMaster.1'"
The error is comming from Line 16 Char 1. That is the line that reads: Set
oMaster = CreateObject("PrintMaster.PrintMaster.1")
Any help is appreciated
Thanks
Chris
ccoates@gfs.com
' Printer setup
' This script creats printer ports And installs printers by reading the
' Printer name, Location, driver And IP address from Excell
Dim oPort
Dim oMaster
Dim oPrinter
Dim IP
Dim Net
Dim Model
Dim Location
Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
Set oPort = CreateObject("Port.Port.1")
Set oPrinter = CreateObject("Printer.Printer.1")
'*************** This is the Read Excell Part*******************
Set objXL = CreateObject("Excel.Application")
set objWB = objXL.Workbooks.Open( "c:\printers.xls")
' name of the spreadsheet
Set objWS = objWB.Worksheets("GR") 'assumes the sheet is "sheet1"
objXL.Visible = TRUE
i = 1
' This keeps it from reading the firt line of the spread sheet in case there
are headers
For s = 1 To 135
'This Is the number of lines In the spreadsheet
i = i + 1
IP = objWS.Cells(i,1).Value
Net = objWS.Cells(i,2).Value
Model = objWS.Cells(i,3).Value
location = objWS.Cells(i,5).Value
WScript.Echo i& " " & IP& " " & Net& " " & Model& " " & Location
' *******************************************************************
oPort.ServerName = ""
oPort.PortName = "IP_"&IP
oPort.PortType = 1
oPort.HostAddress = IP
oPort.PortNumber = 9100
oPort.SNMP = false
oPort.SNMPDeviceIndex = 1
oPort.CommunityName = "public"
oPort.QueueName = ""
oPort.DoubleSpool = false
oMaster.PortAdd oPort
If Err <> 0 Then
end If
oPrinter.ServerName = oPort.ServerName
oPrinter.PrinterName = Net
oPrinter.Shared = True
oPrinter.ShareName = Net
oPrinter.Location = Location
oPrinter.Comment = ""
oPrinter.EnableBidi = false
oPrinter.DriverName = Model
oPrinter.PortName = oPort.PortName
oPrinter.DriverPath = ""
oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
oMaster.PrinterAdd oPrinter
oMaster.PrinterSet oPrinter
Next
If Err <> 0 then
end If