Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Microsoft developed the Network Location Awareness (NLA) functionality years ago, and new possibilities were added since Vista and now Windows 7 have been released. So now you can make a security configuration switching whether you are connected to your domain or a public network. It's very useful for laptop configuration, which "move" often...

Is it possible to have anything else happen other than switching the firewall policies? Like running a script?

share|improve this question
When the network type changes it uses the corresponding firewall configuration by default for that network type. What exactly are you looking to run or do when the network type changes? – Brad Jun 10 '15 at 15:50

You could do a network dump

netsh -c interface dump > %temp%\location_now.txt

Then you could compare it to a list of your "known" networks and/or have it do something different depending on which network you were on.

fc %temp%\location_now.txt %temp%\location2.txt > nul
if %errorlevel%==0 goto location2
::catch all
call c:\batch\foreign_network.bat
call c:\batch\location2.bat

I think this is best case scenario for you. This doesn't really address if you have an IP change (which could be fixed with DHCP reservations based on MAC address), it also doesn't fix the issue of actually when to run the batch file. Best you could do is have it scheduled to run every 30 minutes to check the network connection, set it up as a service to run, or tell your users to double click on the desktop icon when they plug into a new network.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.