Re: WMI EnableStatic Method hangs vb app
- From: "Nick" <nporelle@xxxxxxxxx>
- Date: 6 Nov 2006 06:58:35 -0800
Thanks for the reply. The problem occurs when executing the method.
The call happens and the change is implemented, however the WMI
connection to the host is lost since the IP is no longer set to what it
was when the initial connection was made. When I execute the method on
a local machine the enablestatic method works as expected with the
return values you linked in your reply, but making the changes remotely
cause the app to hang.
Here is the code for the EnableStatic Method. The app hangs where I've
drawn the arrow on the dim outparams line.
If (isEmbedded = False) Then
Dim inParams As System.Management.ManagementBaseObject
inParams("IPAddress") = CType(IPAddress, String())
inParams("SubnetMask") = CType(SubnetMask, String())
------>>> Dim outParams As System.Management.ManagementBaseObject =
NetAdapter.InvokeMethod("EnableStatic", inParams, Nothing)
Manbinder Pal Singh [MSFT] wrote:
It shouldn't hang. You shuold be getting one of the return codes as
You should see what exactly is hanging. Is this some following call? Can you
also try the same on other box.
Manbinder Pal Singh
This posting is provided "AS IS" with no warranties, and confers no rights.
"Nick" <nporelle@xxxxxxxxx> wrote in message
I'm currently working on a program in VB.Net 2005 to remotely change
the IP/Subnet Mask of a specified host. The problem occurs when I
change the IP address/Subnet Mask using the EnableStatic method, the
WMI connection to the remote host is lost since the IP address has
changed and the app is waiting for a return value indicating the
success or failure of the change.
Is there somewhere I can lower the timeout value or indicate that I do
not want the return value from the method so that I can re-initiate the
WMI connection with the new IP?
I've got it working using psexec and Netsh, but I'd like to avoid using
this procedure if at all possible.