Board index » Visual Studio » Add Printer Port to W2k3 server

Add Printer Port to W2k3 server

Visual Studio177
I'm building a new Windows Server 2003 to replace our Windows 2000

print server. I an trying to create the printer ports on the new

server using a standard script, but I receive the following error

message:



addport1.vbs(2, 1) Microsoft VBScript runtime error: Object doesn't

support this property or method: 'objPrinter.Get'



The script is below:



Set objPrinter = GetObject("winmgmts:

{impersonationLevel=Impersonate ," & "(LoadDriver)}!//./root/

cimv2:Win32_Printer")

Set objNewPort =

objPrinter.Get("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort.Name = "IP_169.254.110.14"

objNewPort.Protocol = 1

objNewPort.HostAddress = "169.254.110.14"

objNewPort.PortNumber = "9999"

objNewPort.SNMPEnabled = False

objNewPort.Put_



Please tell me what I'm doing wrong and what I need to change to make

this work.



Thank you.


-
 

Re:Add Printer Port to W2k3 server

On Aug 10, 3:19 pm, Cmor <cmor17...@gmail.com>wrote:

Quote
I'm building a new Windows Server 2003 to replace our Windows 2000

print server. I an trying to create the printer ports on the new

server using a standard script, but I receive the following error

message:



addport1.vbs(2, 1) Microsoft VBScript runtime error: Object doesn't

support this property or method: 'objPrinter.Get'



The script is below:



Set objPrinter = GetObject("winmgmts:

{impersonationLevel=Impersonate ," & "(LoadDriver)}!//./root/

cimv2:Win32_Printer")

Set objNewPort =

objPrinter.Get("Win32_TCPIPPrinterPort").SpawnInstance_

objNewPort.Name = "IP_169.254.110.14"

objNewPort.Protocol = 1

objNewPort.HostAddress = "169.254.110.14"

objNewPort.PortNumber = "9999"

objNewPort.SNMPEnabled = False

objNewPort.Put_



Please tell me what I'm doing wrong and what I need to change to make

this work.



Thank you.



I got it working using the following:

Dim objWMIService, objNewPort

Set objWMIService = GetObject("winmgmts:" _

& "{impersonationLevel=impersonate ,(LoadDriver)}!\\.\root

\cimv2")

Set objNewPort = objWMIService.Get _

("Win32_TCPIPPrinterPort").SpawnInstance_



-