Link to home
Start Free TrialLog in
Avatar of GeertHon
GeertHonFlag for Belgium

asked on

local TCP/IP port creation fails

I try to create a TCP/IP print port via a VBscript on a x64 Windows XP machine, but keep on getting an error that the port can't be created.

In the wmiprov.log file I find the following entry:
   (Mon Dec 28 14:23:29 2009.120921) : WDM call returned error: 4200
(Mon Dec 28 14:23:30 2009.121078) : ***************************************
(Mon Dec 28 14:23:30 2009.121078) : Could not get pointer to binary resource for file:
(Mon Dec 28 14:23:30 2009.121078) : C:\WINDOWS\System32\drivers\afd.sys[AfdMofResource](Mon Dec 28 14:23:30 2009.121078) :
(Mon Dec 28 14:23:30 2009.121078) : ***************************************
(Mon Dec 28 14:23:40 2009.131656) : Received Event

The VBScript used to perform the port creation is:
Set objInputFile = objFileSystem.OpenTextFile(addrFile, OPEN_FILE_FOR_READING)
pIPAddress = objInputFile.ReadLine()

' Create Printer Port
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & MyComputer & "\root\cimv2")
Set objNewPort = objWMIService.Get("Win32_TCPIPPrinterPort").SpawnInstance_
objNewPort.Name = "IP_" & pIPAddress & ""
objNewPort.Protocol = 1
objNewPort.HostAddress = "" & pIPAddress & ""
objNewPort.PortNumber = "9100"
objNewPort.SNMPEnabled = False
objNewPort.Put_

The computer in question runs Windows XP Professional x64 edition SP2
and has all patches installed.
The processor is a Intel Xeon 5160 @ 3.00 GHz

Any help to resolve this is very well appreciated :)
Avatar of Kamran Arshad
Kamran Arshad
Flag of Pakistan image

ASKER CERTIFIED SOLUTION
Avatar of GeertHon
GeertHon
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial