T
tedsullivan
This code always returns ReturnValue = 740 which is not a WbemErrorEnum
(http://msdn.microsoft.com/en-us/library/aa393978(VS.85).aspx ).
This is on a Windows Server 2008 Standard. 3.5 .Net is installed.
Both Win32_NetworkAdapter disable and enable methods fail with error code
740. But if Network "External Connection" is Enabled then trying to enable
returns 0 which I supose is success.
The S3, Z string is to watch the ManagementObject X in the debugger.
Anybody know why?
-------
Dim NetConnectionID As String = ""
Dim M As ManagementClass = New
ManagementClass("Win32_NetworkAdapter")
For Each X As ManagementObject In M.GetInstances()
Dim s3 As String = X.GetText(TextFormat.Mof)
Try
NetConnectionID = X("NetConnectionID").ToString
Catch ex As Exception
NetConnectionID = ""
End Try
If NetConnectionID = "External Connection" Then
Dim Y As ManagementBaseObject = X.InvokeMethod("Enable",
Nothing, Nothing)
Dim Z As String = Y("ReturnValue")
Exit For
End If
Next
(http://msdn.microsoft.com/en-us/library/aa393978(VS.85).aspx ).
This is on a Windows Server 2008 Standard. 3.5 .Net is installed.
Both Win32_NetworkAdapter disable and enable methods fail with error code
740. But if Network "External Connection" is Enabled then trying to enable
returns 0 which I supose is success.
The S3, Z string is to watch the ManagementObject X in the debugger.
Anybody know why?
-------
Dim NetConnectionID As String = ""
Dim M As ManagementClass = New
ManagementClass("Win32_NetworkAdapter")
For Each X As ManagementObject In M.GetInstances()
Dim s3 As String = X.GetText(TextFormat.Mof)
Try
NetConnectionID = X("NetConnectionID").ToString
Catch ex As Exception
NetConnectionID = ""
End Try
If NetConnectionID = "External Connection" Then
Dim Y As ManagementBaseObject = X.InvokeMethod("Enable",
Nothing, Nothing)
Dim Z As String = Y("ReturnValue")
Exit For
End If
Next