Note: I have been informed that there is a bug in Ubuntu related to snapshotted machines, which basically this scripts creates. Please read more here!!
UPDATE: There is an updated version of the script available here. It is based on the script below, but will have some additional features included.