I have set up some network path in Windows 8.1 which can only be accessed when I’m connected to a VPN. I don’t want to re-map/add them every time when I connect to the VPN (I do this quite often).
If I’m not connected to the VPN, however, explorer.exe gets very laggy. I can fix the issue by disabling the “Client for Microsoft Networks” in the properties of the network adapter (see https://superuser.com/a/390043). But then I can’t access any network path. This is even worse, because then I can’t access my locale network path which I need always, of course.
I tried it with both ways: mapping a drive letter to the network path or using the full name. Problem exists in both cases.
Another annyoing thing is: when drag-dropping a file between two explorer windows and randomly hovering the non-available network path “half-way” (because it’s in the list that teh mouse cursor needs to pass) while dragging lets the explroer.exe hang for ~3-5 seconds as if crashed.
How do I set up Windows to not get laggy when having non-available network paths without disabling the network path functionality at all?
With “laggy” I mean two things:
- all programs accessing filesystem using Windows own Open/Save dialogs “hang” for ~3 seconds
- I have to hit F5 after each filesystem operation in Explorer (copy, move, etc.), see Explorer does not auto-refresh
You can use c:/windows/system32/drivers/etc/hosts file to block the VPN destinations. For example, add these lines will block vpn-computer1 and 2:
127.0.0.1 vpn-computer1 127.0.0.1 vpn-computer2
When VPN is connected, these entry needs to be removed, which can be done with a batch file.
I solved it now this way. I added a firewall rule to the Windows firewall (incoming and outgoing with the same name) and enable/disable it via batch file with
netsh advfirewall firewall set rule name="rulename" new enable=yes (resp.
no). This works now perfectly fine.