Last active
July 16, 2025 03:16
-
-
Save simply-coded/510c789d575e6bff12a3d455c2f5d1e9 to your computer and use it in GitHub Desktop.
Revisions
-
simply-coded revised this gist
Oct 1, 2016 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Option Explicit Dim interface, interfaceName, interfaceTarget, available, verb 'Pick the Interface Name you want to disable interfaceName = "Wi-Fi" 'Find available Names by running this script or in cmd '>> netsh interface show interface [enter] This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Option Explicit Dim interface, interfaceName, interfaceTarget, available, verb 'Pick the Interface Name you want to enable interfaceName = "Wi-Fi" 'Find available Names by running this script or in cmd '>> netsh interface show interface [enter] -
simply-coded revised this gist
Oct 1, 2016 . No changes.There are no files selected for viewing
-
simply-coded created this gist
Oct 1, 2016 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ '************************ 'Name: Disable Connection 'Author: Jeremy England 'Company: SimplyCoded 'Date: 10/01/2016 '************************ Option Explicit Dim interface, interfaceName, interfaceTarget, available, verb 'Pick the Interface Name you want to disable/enable interfaceName = "Wi-Fi" 'Find available Names by running this script or in cmd '>> netsh interface show interface [enter] 'Set up required objects Dim objApp : Set objApp = CreateObject("Shell.Application") Dim objFolder : Set objFolder = objApp.Namespace(&H31&).Self.GetFolder 'Check if Network Connections folder exists If objFolder Is Nothing Then MsgBox "Network Connections folder not found. Check the location: ""C:\Windows\System32\ncpa.cpl""", vbCritical WScript.Quit End If 'Make sure interface exists Set interfaceTarget = Nothing 'Interface exists For Each interface In objFolder.Items If LCase(interface.Name) = LCase(interfaceName) Then Set interfaceTarget = interface End If available = available & interface.Name & vbLf Next 'Interface Doesn't exist If interfaceTarget Is Nothing Then MsgBox "Interface Name: """ & interfaceName & """ not found. " &_ "Available Interface Names: " & vbLf & vbLf & available, vbCritical WScript.Quit End If 'Interface Enable / Disable Dim success : success = False For Each verb In interfaceTarget.Verbs If verb.Name = "Disa&ble" Then verb.DoIt WScript.Sleep 1000 MsgBox "Disabled: """ & interfaceName & """", vbInformation success = True Exit For End If Next If Not success Then MsgBox "Already disabled : """ & interfaceName & """", vbInformation End If This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ '*********************** 'Name: Enable Connection 'Author: Jeremy England 'Company: SimplyCoded 'Date: 10/01/2016 '*********************** Option Explicit Dim interface, interfaceName, interfaceTarget, available, verb 'Pick the Interface Name you want to disable/enable interfaceName = "Wi-Fi" 'Find available Names by running this script or in cmd '>> netsh interface show interface [enter] 'Set up required objects Dim objApp : Set objApp = CreateObject("Shell.Application") Dim objFolder : Set objFolder = objApp.Namespace(&H31&).Self.GetFolder 'Check if Network Connections folder exists If objFolder Is Nothing Then MsgBox "Network Connections folder not found. Check the location: ""C:\Windows\System32\ncpa.cpl""", vbCritical WScript.Quit End If 'Make sure interface exists Set interfaceTarget = Nothing 'Interface exists For Each interface In objFolder.Items If LCase(interface.Name) = LCase(interfaceName) Then Set interfaceTarget = interface End If available = available & interface.Name & vbLf Next 'Interface Doesn't exist If interfaceTarget Is Nothing Then MsgBox "Interface Name: """ & interfaceName & """ not found. " &_ "Available Interface Names: " & vbLf & vbLf & available, vbCritical WScript.Quit End If 'Interface Enable / Disable Dim success : success = False For Each verb In interfaceTarget.Verbs If verb.Name = "En&able" Then verb.DoIt WScript.Sleep 1000 MsgBox "Enabled: """ & interfaceName & """", vbInformation success = True Exit For End If Next If Not success Then MsgBox "Already enabled : """ & interfaceName & """", vbInformation End If This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,55 @@ '*********************** 'Name: Toggle Connection 'Author: Jeremy England 'Company: SimplyCoded 'Date: 10/01/2016 '*********************** Option Explicit Dim interface, interfaceName, interfaceTarget, available, verb 'Pick the Interface Name you want to disable/enable interfaceName = "Wi-Fi" 'Find available Names by running this script or in cmd '>> netsh interface show interface [enter] 'Set up required objects Dim objApp : Set objApp = CreateObject("Shell.Application") Dim objFolder : Set objFolder = objApp.Namespace(&H31&).Self.GetFolder 'Check if Network Connections folder exists If objFolder Is Nothing Then MsgBox "Network Connections folder not found. Check the location: ""C:\Windows\System32\ncpa.cpl""", vbCritical WScript.Quit End If 'Make sure interface exists Set interfaceTarget = Nothing 'Interface exists For Each interface In objFolder.Items If LCase(interface.Name) = LCase(interfaceName) Then Set interfaceTarget = interface End If available = available & interface.Name & vbLf Next 'Interface Doesn't exist If interfaceTarget Is Nothing Then MsgBox "Interface Name: """ & interfaceName & """ not found. " &_ "Available Interface Names: " & vbLf & vbLf & available, vbCritical WScript.Quit End If 'Interface Enable / Disable For Each verb In interfaceTarget.Verbs If verb.Name = "En&able" Then verb.DoIt WScript.Sleep 1000 MsgBox "Enabled: """ & interfaceName & """", vbInformation ElseIf verb.Name = "Disa&ble" Then verb.DoIt WScript.Sleep 1000 MsgBox "Disabled: """ & interfaceName & """", vbInformation End If Next