How do I change my TimeMachine volume in a script

Time Machine supports multiple backup volumes on Mountain Lion.

Backup to multiple locations

Time Machine allows you to choose multiple backup locations and seamlessly switch between them. Now you can have a backup of your data at work and at home.