Managing and deploying Time Machine in Lion

Quite a few environments are using Time Machine for their backup solution. But prior to Lion there hasn’t been a simple way to manage or deploy Time Machine. With Mac OS X 10.7 Apple has introduced a new command line tool, tmutil, to help us manage Time Machine. The tmutil command allows administrators to enable Time Machine, make snapshots, kick off backups, delete snapshots, perform restores, configure options within Time Machine and, with a little scripting, build a centralized dashboard, pulling in Time Machine statistics from clients.
Pretty much everything you do in Time Machine is going to require elevated privileges. So if you are writing a script, it should run as such, or if you’re running each command independently you will likely need to prefix them with sudo.
So lets us look at some examples of using the tmutil command line tool.
To Enable Time Machine:
tmutil enable
To Disable Time Machine:
tmutil disable
To enable local backups, turning on snapshots:
tmutil enablelocal
To associate Time Machine with a disk:
tmutil setdestination /Volumes/backupdrive
To associate Time Machine with a network mount:
tmutil setdestination afp://
To add a directory or volume to the exclusion list:
tmutil addexclusion /Developer
 To remove a directory or volume from the exclusion list:
tmutil removeexclusion /Developer
 To manually run the backup:
tmutil startbackup
To stop the current backup:
tmutil stopbackup