Hello All
i have windows 2003 server and i need to install 170 Tcp printer ports
i need a script how can build number of ports at one time
i try to use this scrip - but this script build only one port evry time
vbs
Set objWMIService = GetObject("winmgmts:")
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_10.0.0.130"
objNewPort.Protocol = 1
objNewPort.HostAddress = "10.0.0.130"
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_

Please Help

Re: Build Printers Ports by hypnos

hypnos
Fri Jan 28 11:39:50 CST 2005

create a list of IP's and put in a txt file called IP.txt in the same
directory as the script

This should work for you...

Const ForReading = 1
Set objWMIService = GetObject("winmgmts:")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set f = objFSO.OpenTextFile(".\IP.txt", ForReading, 0)
Do While f.AtEndOfStream <> True
IP = f.Readline
Set objNewPort = objWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_" & IP
objNewPort.Protocol = 1
objNewPort.HostAddress = IP
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_
Loop
f.close