Problem with script to add printers ports, need help.



I am trying to add a large quantity of printers to a new printserver. I
first want to add the printer ports but I am running into a problem.
Whenever I run the script below it errors out with "Access Denied".

Just for the heck of it I ran the template script from the script center and
I get the same error. Does anyone have an idea why I get that error? Am I
missing something in my script? And yes I am admin on the box.

Here is the script.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open("C:\Scripts\Printer\New_ports.xls")
objExcel.Visible = True
intRow = 2
Do Until objExcel.Cells(intRow,1).Value = ""
strComputer = "."
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = objExcel.Cells(intRow,5).Value
objNewPort.Protocol = 1
objNewPort.HostAddress = objExcel.Cells(intRow,1).Value
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
intRow = intRow + 1
Loop
objExcel.Quit

I appreciate any advice.

Thanks,

Ray
.



Relevant Pages

  • How to check OU and pull from Spreedshet to script, vb/batch?
    ... installs printer ports and then the printers/drivers that are related to the ... a computers OU and then comparing the OU in a spreadsheet to the correct ... printers needed to be installed and applying them in the script. ...
    (microsoft.public.windows.server.scripting)
  • How to check OU and pull from Spreedshet to script, vb/batch?
    ... installs printer ports and then the printers/drivers that are related to the ... a computers OU and then comparing the OU in a spreadsheet to the correct ... printers needed to be installed and applying them in the script. ...
    (microsoft.public.windows.server.scripting)
  • Re: Problem with script to add printers ports, need help.
    ... Last line to send output is line before failure. ... > first want to add the printer ports but I am running into a problem. ... > Whenever I run the script below it errors out with "Access Denied". ...
    (microsoft.public.windows.server.scripting)
  • Printer ports and Installs
    ... I was wondering if anyone could help me with a vb script that would be setup ... Create all printer ports on a xp/win2000 machine ... Prev by Date: ...
    (microsoft.public.windows.server.scripting)
  • Comparison Script Components with Script Classes
    ... Now I would like to have some advice from more experienced programmers. ... I do not really figure out, how the concepts of Script Components and Script Classes differ and for what use cases they are intended. ... How do you build your strictly object-oriented libraries in VBScript? ...
    (microsoft.public.scripting.vbscript)