I have a script that installs a TCP/IP printer port and shared printer.
The script works fine. (See Below)
However I need to install over 100 different printers to my print server.
All the printer speciffic information I need is in an Excell spread sheet,
(Port name, IP address, Driver name, Printer name, Share name, Location,
etc. ).
I want to run this script and have it create all my printer ports and
printer shares.

I know I will have to change the printer speciffic data in the script to
variables, but I am not sure how to have the script read the data form
either Excell or a .CSV file.
I assume I will then have to setup some kind of loop.

I am new to scripting and any help is appreciated.

Thanks

Chris Coates
ccoates@gfs.com



Dim oPort
Dim oMaster
Dim oPrinter

Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
Set oPort = CreateObject("Port.Port.1")
Set oPrinter = CreateObject("Printer.Printer.1")

oPort.ServerName = ""
oPort.PortName = "IP_10.251.1.94"
oPort.PortType = 1
oPort.HostAddress = "10.251.1.94"
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 = "NET957"
oPrinter.Shared = True
oPrinter.ShareName = "NET957"
oPrinter.Location = "HR"
oPrinter.Comment = ""
oPrinter.EnableBidi = false
oPrinter.DriverName = "HP LaserJet 8000 Series PCL"
oPrinter.PortName = oPort.PortName
oPrinter.DriverPath = ""
oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
oMaster.PrinterAdd oPrinter
oMaster.PrinterSet oPrinter

If Err <> 0 then
end If

Re:Need to reed data into a script by Mo

Mo
Mon Feb 20 13:40:22 CST 2006

This is the bare essentials of reading data from a spreadsheet using
vbscript

Set objXL = CreateObject("Excel.Application")
set objWB = objXL.Workbooks.Open( "Your-Data.xls) ' name of the spreadsheet
Set objWS = objWB.Worksheets("Sheet1") 'assumes the sheet is "sheet1"
objXL.Visible = TRUE ' Not needed but it gives you an idea it's working
For i = 1 To 30
wscript.echo objWS.Cells(iCnt,1).Value ' echoes the values in Rows
1 to 30 Column 1 to the screen
Next

Re: Re:Need to reed data into a script by Chris

Chris
Mon Feb 20 14:28:10 CST 2006

Mo

I am getting an unknown runtime error in line 7. It seems like there is an
issue with the (iCnt,1).
Here is my script.

Set objXL = CreateObject("Excel.Application")
set objWB = objXL.Workbooks.Open( "c:\printers.xls")
Set objWS = objWB.Worksheets("GR")
objXL.Visible = TRUE ' Not needed but it gives you an idea it's working
For i = 1 To 30
wscript.echo objWS.Cells(iCnt,1).Value
' echoes the values in Rows 1 to 30 Column 1 to the screen
Next

Thanks

Chris

"Mo Childs" <mig.cervantes@gmail.cam> wrote in message
news:110defd76ee64f4dbe8c9e50c590bcba@ureader.com...
> This is the bare essentials of reading data from a spreadsheet using
> vbscript
>
> Set objXL = CreateObject("Excel.Application")
> set objWB = objXL.Workbooks.Open( "Your-Data.xls) ' name of the
> spreadsheet
> Set objWS = objWB.Worksheets("Sheet1") 'assumes the sheet is "sheet1"
> objXL.Visible = TRUE ' Not needed but it gives you an idea it's working
> For i = 1 To 30
> wscript.echo objWS.Cells(iCnt,1).Value ' echoes the values in Rows
> 1 to 30 Column 1 to the screen
> Next



Re: Need to reed data into a script by asdf

asdf
Thu Feb 23 03:52:27 CST 2006

If I were Ms, I'd expect those objects to be installed on every machine.








"Chris Coates" <ccoates@gfs.com> wrote in message
news:%23HCjMDlNGHA.2300@TK2MSFTNGP15.phx.gbl...
> I have a script that installs a TCP/IP printer port and shared printer.
> The script works fine. (See Below)
> However I need to install over 100 different printers to my print server.
> All the printer speciffic information I need is in an Excell spread sheet,
> (Port name, IP address, Driver name, Printer name, Share name, Location,
> etc. ).
> I want to run this script and have it create all my printer ports and
> printer shares.
>
> I know I will have to change the printer speciffic data in the script to
> variables, but I am not sure how to have the script read the data form
> either Excell or a .CSV file.
> I assume I will then have to setup some kind of loop.
>
> I am new to scripting and any help is appreciated.
>
> Thanks
>
> Chris Coates
> ccoates@gfs.com
>
>
>
> Dim oPort
> Dim oMaster
> Dim oPrinter
>
> Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
> Set oPort = CreateObject("Port.Port.1")
> Set oPrinter = CreateObject("Printer.Printer.1")
>
> oPort.ServerName = ""
> oPort.PortName = "IP_10.251.1.94"
> oPort.PortType = 1
> oPort.HostAddress = "10.251.1.94"
> 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 = "NET957"
> oPrinter.Shared = True
> oPrinter.ShareName = "NET957"
> oPrinter.Location = "HR"
> oPrinter.Comment = ""
> oPrinter.EnableBidi = false
> oPrinter.DriverName = "HP LaserJet 8000 Series PCL"
> oPrinter.PortName = oPort.PortName
> oPrinter.DriverPath = ""
> oPrinter.InfFile = "c:\windows\inf\ntprint.inf"
> oMaster.PrinterAdd oPrinter
> oMaster.PrinterSet oPrinter
>
> If Err <> 0 then
> end If
>
>
>