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
= Nothing
inParams =
NetAdapter.GetMethodParameters("EnableStatic")
inParams("IPAddress") = CType(IPAddress, String())
inParams("SubnetMask") = CType(SubnetMask, String())
------>>> Dim outParams As System.Management.ManagementBaseObject =
NetAdapter.InvokeMethod("EnableStatic", inParams, Nothing)
Return
System.Convert.ToUInt32(outParams.Properties("ReturnValue").Value)
Else
Return System.Convert.ToUInt32(0)
End If
Thanks
Nick
Manbinder Pal Singh [MSFT] wrote:
It shouldn't hang. You shuold be getting one of the return codes as
mentioned in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/enablestatic_method_in_class_win32_networkadapterconfiguration.asp.
You should see what exactly is hanging. Is this some following call? Can you
also try the same on other box.
Thank You,
Manbinder Pal Singh
This posting is provided "AS IS" with no warranties, and confers no rights.
"Nick" <nporelle@xxxxxxxxx> wrote in message
news:1162490005.323014.325510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
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.
Thanks
Nick
.
- References:
- WMI EnableStatic Method hangs vb app
- From: Nick
- Re: WMI EnableStatic Method hangs vb app
- From: Manbinder Pal Singh [MSFT]
- WMI EnableStatic Method hangs vb app
- Prev by Date: Accessing static ip pool using WMI
- Next by Date: Re: Where to get Syste SMBIOS data?
- Previous by thread: Re: WMI EnableStatic Method hangs vb app
- Next by thread: Re: Set NIC speed/duplex using WMI
- Index(es):
Relevant Pages
|