RE: Create a Local Printer Port with a particular name through a Scrip

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: ghost (ghost_at_discussions.microsoft.com)
Date: 06/28/04

  • Next message: ghost: "Windows 2003 WMI install Printer Problem"
    Date: Mon, 28 Jun 2004 13:52:01 -0700
    
    

    try this, add varibales as needed

    strportname = "something"
    strIpAddress = "something"
    Set objWMIService = GetObject("winmgmts:")
    Set objNewPort = objWMIService.Get _
        ("Win32_TCPIPPrinterPort").SpawnInstance_
    objNewPort.Name = "strPortName"
    objNewPort.Protocol = 1
    objNewPort.HostAddress = "strIpAddress"
    objNewPort.PortNumber = "9100"
    objNewPort.SNMPEnabled = False
    objNewPort.Put_

    "Julien" wrote:

    > Could someone tell me how to create a Local Printer Port named for example "PORT1" dynamically through a script?
    >
    > I would need to do that in order to assign this Local Port a Network Printer with particular Credentials to the User logging in to the Domain, via "NET USE PORT1: \\my_Server\my_Printer my-Password /USER:my_Domain\my_User" .
    >
    > I hope someone will be able to help me out with this question.
    > Thanks in advance.
    > Julien.


  • Next message: ghost: "Windows 2003 WMI install Printer Problem"