Thanks I order the XP DDK on CD to take a look and possibly generate a better solution than using the Devcon.exe program. In the meantime I did get this to work, its not complete but it seems to work. Of course it relies on WMI and the Devcon executable. Thanks for your help Tom Private Sub ChangeAdapterStatus(ByVal mAdapter As String, ByVal mStatus As String) Dim oMngt As New ManagementScope("\\.") ' local machine Dim oMs As New System.Management.ObjectQuery Dim oSearch As New ManagementObjectSearcher Dim oColl As ManagementObjectCollection Dim oRcd As New ManagementObject Dim oNic As PropertyData Dim oState As String Dim ret As Integer ' Try oMs.QueryString() = "SELECT NetConnectionID, NetConnectionStatus, PNPDeviceID" & _ " FROM Win32_NetworkAdapter" & _ " Where NetConnectionID = '" & mAdapter & "'" ' " Where NetConnectionID like '%'" This returns all configed adpt oSearch.Scope = oMngt oSearch.Query = oMs oColl = oSearch.Get For Each oRcd In oColl oNic = oRcd.Properties.Item("PNPDeviceID") Dim oDevHld As String = oNic.Value Dim oDevID() As String = oDevHld.Split("&") Dim oCmd As String = "\devcon.exe " & mStatus & " *" & oDevID(1) & "* updateni" ret = Shell(Application.StartupPath & oCmd) Next Catch ex As ManagementException MsgBox(ex.Message) End Try End Sub Tom
vbTom
Posts
-
How to disable the NIC? -
How to disable the NIC?Thanks for the quick response. I will look into the solution you mentioned. Also I found this KB http://support.microsoft.com/?kbid=311272 it is a command line utility of the device manager which I may use as a last resort. Once again thanks. Tom
-
How to disable the NIC?Hi I have been trying to find a way to do this thru WMI but do not see any methods and all properties are read only. Can you point me in the right direction I am using Win32_NetworkAdapter I searched others and am unable to find a way to do it. Any help is appreciated. Thanks Tom
-
Passing command line arguments to vb.netThanks that worked Tom
-
Passing command line arguments to vb.netI know this should be simple but I can't get it to work. Isn't there a way to pass command line arg's to a vb.net program without have to use the vb6 class? I search help but I must haver it installed incorrectly becuase it keeps saying it is updating my recent changes? Thanks Tom Tom