Below is a snippet of code I am using. I want to set the IP, subnet
and default gateway of my local computer via code. However, when I do
it, I get a "not found" (error number 5) error on the default gateway
line.
Dim GateArray() As String = {"99.99.99.1"} 'Array
Dim inPar As ManagementBaseObject = Nothing
Dim outPar As ManagementBaseObject = Nothing
Dim blah As ManagementBaseObject()
inPar = mo.GetMethodParameters("EnableStatic")
inPar("IPAddress") = New String() {"99.99.99.2"}
inPar("SubnetMask") = New String() {"255.255.255.0"}
inPar("DefaultIPGateway") = LBound(GateArray) 'New String()
{"99.99.99.1"}
outPar = mo.InvokeMethod("EnableStatic", inPar, Nothing)
Any ideas what is wrong? I read that the default gateway is an array
so I am trying to find it the value that way but I get the same error
if I just use a string.
Thanks