Setting a script at startup to check for specific wifi connection and then run command?

whitenack

Distinguished
Jun 26, 2012
177
0
18,680
Hi,

I have a work laptop that, while at work, needs to be connected to a dns server to get reliable service. So, whenever I am at work, I have to go into Network and Sharing Center, go into the IPv4 settings, set the dns IP address, etc. The problem is that if I take my laptop offsite, I can't connect to the wifi network of where I am until I clear that dns IP address. It's not a huge deal, but it is inconvenient and I have a couple of other laptops that other, less-tech-savvy users operate.

First, is there a simple solution that I am overlooking?

If not, can I run a bat file at startup that detects whether I am connected to the work network? If so, I know I can add a command to that bat file to change the dns settings.
 
Solution
i would try running a power shell script triggered to some event in the task scheduler. Just so I would have it done automatically.




whitenack

Distinguished
Jun 26, 2012
177
0
18,680
Thanks for the reply. I'm not always going to be able to change the routers of all the places I go to. If I was just traveling from work to home I could set the home router to match the work router, but I'll be travelling to hotels, condos, public wifis, etc..
 
i would try running a power shell script triggered to some event in the task scheduler. Just so I would have it done automatically.




 
Solution