|
-
February 7th, 2013, 06:05 AM
#1
[RESOLVED] Disconnecting from internet and network
When I am not using the internet or working with sensitive data, I disconnect the lan cable that runs from my router to my computer.
What is the equivalent from a Window perspective or is there a software to do this? Do I just disable the network adapters in Device Manager?
Thanks
Originally wanted Millenium Falcon as nick but there is character limitation.
Falcon Speed = Millenium Falcon = Light Speed
-
February 7th, 2013, 06:46 AM
#2
Disabling the network adapter(s) works.
-
February 7th, 2013, 06:54 AM
#3
Thanks Doc!
Is there a shortcut or bat or vbs file that I can write to toggle enable or disable the network adapters? I believe it can be done in vbs.
Of course, disabling the network adapters will also disable all LAN activities too right? That is what I want; the equivalent to manually disconnect the cable. Nothing coming in or out.
Originally wanted Millenium Falcon as nick but there is character limitation.
Falcon Speed = Millenium Falcon = Light Speed
-
February 7th, 2013, 07:13 AM
#4
Right now I'm on a XP box and I can simply right-click the Network icon (in the 'Notification' area near the clock) and select Disable.
And yes, that would stop all traffic through the adapter.
-
February 7th, 2013, 09:59 AM
#5
If applicable,
Create shortcut to Local Area Connection.
Cheers.
-
February 8th, 2013, 10:22 AM
#6
I am on windows 7. No icon next to the clock but I know what you are referring to in xp. Fastest is device manager until I figure the vbscript for it.
Regardless, thanks for the confirmation on the traffic.
Originally wanted Millenium Falcon as nick but there is character limitation.
Falcon Speed = Millenium Falcon = Light Speed
-
February 9th, 2013, 08:32 AM
#7
To create a shortcut to "Local Area Connection" on your Desktop, click Start, type in "View Network" (without the quotes), select "View Network Connections" from the list and drag the "Local Area Connection" out onto your Desktop. You can now click this new "Local Area Connection" icon to Disable|Enable your connection.
-
March 3rd, 2015, 11:03 PM
#8
I started this thread 2 years ago, looking for a vbs script. If anyone needs it, let me know. I am updating the status.
Originally wanted Millenium Falcon as nick but there is character limitation.
Falcon Speed = Millenium Falcon = Light Speed
-
March 4th, 2015, 07:41 AM
#9
You can use netsh to enable/disable a connection:
- At a cmd prompt, type:
netsh interface show interface
and press [Enter]. The response you get get back might look something like this (from my Desktop computer):
Code:
Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Connected Dedicated Local Area Connection
And on my laptop it looks like this:
Code:
Admin State State Type Interface Name
-------------------------------------------------------------------------
Enabled Connected Dedicated Wireless Network Connection 2
The part you're interested in is the Name of the connection, which I've highlighted above in red.
- Create a new shortcut on your Desktop using that Name in your shortcut command, (I'll use the name from my Desktop computer for this example), like this:
netsh interface set interface "Local Area Connection" Disable
and then name the shortcut something like "Disable Network".
- Create another new shortcut using that same Name again in the command again, like so:
netsh interface set interface "Local Area Connection" Enable
and name it something like "Enable Network".
That's it. Now you can simply click either icon to Disable or Enable your connection.
-
March 4th, 2015, 01:06 PM
#10
Very cool Doc. Although I prefer your method through command prompt and shortcut, I have also been doing it through VBScript. This goes into a file with a "vbs" extension.
Code:
Option Explicit
Dim ws
Set ws = WScript.CreateObject( "WScript.Shell" )
Dim oWMIService
Set oWMIService = GetObject("winmgmts:\\.\root\cimv2")
Dim colAdapters
Set colAdapters = oWMIService.Execquery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID LIKE '%Local Area Connection%' ")
'PURPOSE: List
'Dim strNetworkAdapter
'For Each Adapter in colAdapters
' strNetworkAdapter = strNetworkAdapter & Adapter.Name & vbCRLF
'Next
'WScript.Echo strNetworkAdapter
'(-1 is enabled, 0 is disabled)
Dim strStatus
Dim errReturn
If colAdapters.ItemIndex(0).NetEnabled = -1 Then
'errReturn = colAdapters.ItemIndex(0).Disable() 'METHOD 1
strStatus = "Disabled"
Else
'errReturn = colAdapters.ItemIndex(0).Enable() 'METHOD 1
strStatus = "Enabled"
End If
Call ws.Run("netsh interface set interface name=" & CHR(34) & "Local Area Connection" & CHR(34) & " admin=" & strStatus, 1, False) 'METHOD 2
WScript.Echo "NetEnabled = " & strStatus
Set colAdapters = Nothing
Set oWMIService = Nothing
Set ws = Nothing
I can also combine what you have shared, using ws.Run(command prompt), and therefore, it would be one shortcut acting as a toggle switch.
BTW... I noticed that we can use "Enabled" or "Enable". Either spelling works. Is there any reason behind this?
Thanks
Last edited by Falcon Speed; March 4th, 2015 at 01:17 PM.
Originally wanted Millenium Falcon as nick but there is character limitation.
Falcon Speed = Millenium Falcon = Light Speed
-
March 4th, 2015, 02:39 PM
#11
1) Pretty slick. 
2) Nary a clue.
-
March 4th, 2015, 04:34 PM
#12
2) Either works probably because a search for Enable finds both in the command line. You might find that Enablex would work also. It also makes for easier use, although that is not generally thought of as a standard Microsoft practice.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|