Monday, July 2, 2012

Simple script to clone a Vmware server.


I needed to clone a couple of virtual machines so I installed PowerCLI and created this small script. I can schedule this and have daily backups. I know cloning may not be the best form of backup but this is what I need today.

c:\>type clone.ps1
connect-viserver 10.1.2.3
remove-vm -deletefromdisk "vm1 - backup"
new-vm -name "vm1 - backup" -datastore ds1 -vm "vm1" -vmhost v01.example.com
disconnect-viserver
c:\>