in reply to Re: Using OLE to enable/disable network adapters in Windows
in thread Using OLE to enable/disable network adapters in Windows

Heya Bloodnok, thanks for the reply.

No, the behaviors between the vbscript version I found on the web and my version are a little different. And by that I mean that their version works without fail and mine well...

  • Comment on Re^2: Using OLE to enable/disable network adapters in Windows

Replies are listed 'Best First'.
Re^3: Using OLE to enable/disable network adapters in Windows
by Anonymous Monk on Oct 03, 2009 at 00:52 UTC
    Show the VB version, maybe your translation is off :)

      No prob. Here is the original vbscript I was working from. It works every time.

      Const ssfCONTROLS = 3 sConnectionName = "Local Area Connection" sEnableVerb = "En&able" sDisableVerb = "Disa&ble" set shellApp = createobject("shell.application" ) set oControlPanel = shellApp.Namespace(ssfCONTROLS) set oNetConnections = nothing for each folderitem in oControlPanel.items if folderitem.name = "Network Connections" then set oNetConnections = folderitem.getfolder: exit for end if next if oNetConnections is nothing then msgbox "Couldn't find 'Network Connections' folder" wscript.quit end if set oLanConnection = nothing for each folderitem in oNetConnections.items if lcase(folderitem.name) = lcase(sConnectionName) then set oLanConnection = folderitem: exit for end if next if oLanConnection is nothing then msgbox "Couldn't find '" & sConnectionName & "' item" wscript.quit end if bEnabled = true set oEnableVerb = nothing set oDisableVerb = nothing s = "Verbs: " & vbcrlf for each verb in oLanConnection.verbs s = s & vbcrlf & verb.name if verb.name = sEnableVerb then set oEnableVerb = verb bEnabled = false end if if verb.name = sDisableVerb then set oDisableVerb = verb end if next if bEnabled then oDisableVerb.DoIt else oEnableVerb.DoIt end if wscript.sleep 1000