Dbyte
Technical User
- Mar 6, 2002
- 87
My goal is to map TCP/IP printers as part of user login scripts. I've written a test script to verify it works on my own PC - it doesn't. Here's my code:
The IP address is valid for the printer & the port is not already in use. If I go through the process manually (add local printer, etc.) w/ the values in the script above it works fine. I am not getting any errors from the script, nor can I find any typos. What am I missing??
Code:
Option Explicit
Dim oWMIService, oNewPort
Set oWMIService = GetObject("winmgmts:")
Set oNewPort = oWMIService.Get _
("Win32_TCPIPPrinterPort").SpawnInstance_
oNewPort.Name = "Test_Printer"
oNewPort.Protocol = 1
oNewPort.HostAddress = "192.168.1.32"
oNewPort.PortNumber = "9100"
oNewPort.SNMPEnabled = False
oNewPort.Put_