Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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
:location2
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

 
discard

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.