Announcement

Collapse
No announcement yet.

Programmatically disable and or enable the network adapter

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Programmatically disable and or enable the network adapter

    Is there a way to programmatically disable and/or re enable the network adapter ?
    This will ensure that the internet or network connection is
    temporarily disconnected and re connected by the user. TQ

  • #2
    Yes,

    Look at Connect and Disconnect METHOD in INTERFACE INetConnection from José's NetCon.inc

    Related: $CLSID_ConnectionManager $CLSID_NetSharingManager IEnumNetConnection EnumConnections also SetupDiChangeState

    Note that Admin privilege must be granted via UAC.
    Last edited by Pierre Bellisle; 15 May 2018, 12:58 PM.

    Comment


    • #3
      Shell and :
      Code:
      netsh interface set interface name="Local Area Connection" admin=disabled
      "=enabled" to turn it back on.

      Comment

      Working...
      X