Re: Problem with script to add printers ports, need help.



I checked the WMI reference. All properties are read-only. This is
probably not the way to create a port. It looks like it is used for getting
info and status.

You might try doing it with "Security" privilege on the "impersonate"
clause.

--
Jim Vierra

"rham" <rham@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:E9B75824-9C8D-4D41-8741-25468183B913@xxxxxxxxxxxxxxxx
> Server 2003 Standard with all current patches except SP1. I am signed on
> with my domain account that has admin rights.
>
> "Jim Vierra" wrote:
>
>> What version of windows?
>> Do you have admin rights on the machine?
>> What service pack level?
>>
>>
>> --
>> Jim Vierra
>>
>> "rham" <rham@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> news:E885E46B-48B3-42D7-92E7-3F4F724D9BBA@xxxxxxxxxxxxxxxx
>> > The error is occuring at the objnewPort.Put_ line. The error message
>> > states:
>> >
>> > Line:15
>> > Char:2
>> > Error: Access Denied
>> > Code: 80041003
>> > Source: SWbemObjectEx
>> >
>> > Thanks,
>> >
>> > Ray
>> >
>> >
>> > "Jim Vierra" wrote:
>> >
>> >> What line number. Is it happening on the "Put_". or the new instance.
>> >>
>> >> Put trace statements in file to see. "WScript.Echo "We Are here trace"
>> >> ...
>> >> etc.
>> >>
>> >> Last line to send output is line before failure. Or count lines from
>> >> top
>> >> of
>> >> notepad starting with "1".
>> >> --
>> >> Jim Vierra
>> >>
>> >> "rham" <rham@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
>> >> news:103C6124-3C6E-45F0-99BB-2F66BE21DA08@xxxxxxxxxxxxxxxx
>> >> >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

  • Re: Safe practices
    ... Linux wins in this respect by the simple expedient of making root access ... access, it's still possible to gain admin rights as long as there is a program that has been started with full admin rights, this due a bad way communication between applications and explorer (the window manager). ... As long as port forwards aren't enabled to the machine, there are cases where people has managed to forward every port to the machine behind the router, they not noticed the error as they only have one machine. ...
    (alt.os.linux)
  • Re: Problem with script to add printers ports, need help.
    ... Do you have admin rights on the machine? ... >> Jim Vierra ... >>> first want to add the printer ports but I am running into a problem. ... >>> Just for the heck of it I ran the template script from the script ...
    (microsoft.public.windows.server.scripting)
  • Re: Always admin rights for only one exec???
    ... I wrote a lil' batch file wich runs 'runas' and ... Always admin rights for only one exec??? ... > Matthias Güntert ... Worms & Port Scans ...
    (Security-Basics)
  • Re: Opening a Port
    ... I thought that if a port is closed, ... The admin of the FW did a port forwarding of a port or ports it or them to unsolicited inbound traffic from the Internet, such as a WEB server sitting there listing for unsolicited inbound traffic from client machines with an browser on port 80, as an example. ... That would mean something behind the FW, a program running on a computer, was sitting there listing on its port or ports for unsolicited inbound traffic from the Internet. ... Admin rights on a machine or a Domain has nothing to do with it that I know about. ...
    (comp.security.firewalls)
  • Re: Problem with script to add printers ports, need help.
    ... Server 2003 Standard with all current patches except SP1. ... with my domain account that has admin rights. ... "Jim Vierra" wrote: ...
    (microsoft.public.windows.server.scripting)