This year at CiscoLive! in Orlando, we had four potential management networks on which our access switches (3750-X and 3560CG) could be deployed. To aid with the provisioning of switches on these networks, I used Cisco Prime LMS to deploy the following applet. This example applet kicks off at reboot and then attempts to ping one of two default gateways after enabling their respective interfaces. When the applet finds the right gateway, it will reconfigure itself for that network. This applet worked 100% of the time for us, and made deployment of new switches much easier. Enjoy!