My script in
could give an idea how to do this.↧
My script in Using multiple datastores, can't migrate the vmx file to a datastore could give an idea how to do this.