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

In reply to Re^4: Using OLE to enable/disable network adapters in Windows by teryx510
in thread Using OLE to enable/disable network adapters in Windows by teryx510

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.