I basically want to shutdown/start some services based on Network name and type I connect, so even better to run script when the network is automatically detected is it possible? Thanks.
I basically want to shutdown/start some services based on Network name and type I connect, so even better to run script when the network is automatically detected is it possible? Thanks.
You can also use the Windows Task Scheduler for listening on the WMI event.
There may be some tool out there, but you can roll your own with some work.
See this link about working with WMI events: http://trevorsullivan.net/2009/11/16/powershell-getting-started-with-wmi-events/
Basically you'd be writing a powershell script or c# program to listen for WMI events, which can be something like a dhcp lease being renewed or the connection coming online. But you'd have to do some more digging for the specific event you want if it's not a the dhcp lease event (which it sounds like it's not.) Then your script can do whatever you want when that event comes up - like starting services etc.
The link should provide you with some direction to keep looking in, or punt because it's kind of a pain.
You'd want to use some kinda of query like this in wbemtest to drill down and see which event you are interested in (like the article spells out). Then you'd do the necessary register-wmi event stuff in powershell once you're happy with your query.
That sounds like the problem that the Network Location Awareness service tries to solve. I bet PowerShell could be employed to use whatever .NET plumbing exists to listen for NLA service events.
You could set up a permanent WMI event consumer, using either the CommandLineEventConsumer or ActiveScriptEventConsumer.
http://msdn.microsoft.com/en-us/library/aa384749(v=VS.85).aspx - Active Script Event Consumer
http://msdn.microsoft.com/en-us/library/aa393249(v=VS.85).aspx - Command Line Event Consumer
Cheers