I run VMWare Workstation 6.5 on WinXP.
How can I script a way to automatically clone my VM images?
I've read about the "vmware-cmd
" tool but believe that is only available with VMWare ESX, not Workstation.
I run VMWare Workstation 6.5 on WinXP.
How can I script a way to automatically clone my VM images?
I've read about the "vmware-cmd
" tool but believe that is only available with VMWare ESX, not Workstation.
Since VMWare images are just files on disk, you can just use XCOPY. When next running the VM you'll be prompted asking if you moved, or copied the VM. Make sure you select copy to ensure the cloned VM network card is assigned a different hardware MAC address.
XCOPY /S /I WinXP WinXPClone
If your guests are Windows based machines, then ensure you generate a new SID on the clone. Sysprep is a pain if you're just cloning for personal use, a much quicker and simpler way is to use NewSID.
You could try PowerShell Scripts
Param(
[Parameter(Position=0,Mandatory=$true,HelpMessage="What Environment do you want exported?")]
[ValidateSet("VCAC","IDENT","IAAS","ORCH","VCENTER","CA","DC","ALL")]
[String[]]$vmExports)
###connect to server statement -- add later
if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null )
{
Add-PSsnapin VMware.VimAutomation.Core
}
if ($vmExports -Contains "ALL" )
{
$vmExports = ("VCENTER")
}
function exportova ([string[]]$servers)
{
foreach($server in $servers)
{
$date = Get-Date -format MMddyyyy
$datastore = ''
$VMhost = ''
$newVMName = $server+'_'+$date
$my_vm = New-VM -Name $newVMName -VM $server -Datastore $datastore -VMHost $VMhost
Export-VApp -Destination "E:\VMs\" -VM $newVMName -Format Ova
Remove-VM $newVMName -DeletePermanently -Confirm:$false
}
}
switch ($vmExports)
{
"VCENTER"
{
$servers= ("")
exportova $servers
}
}
I think using Scripts is a bad way to go about when it comes to backing up virtual machines within vSphere i did this approach before and ran into trouble when it came to moving virtual machines around, while some machines had dependencies or someone left a virtual disk still attached to that cloned machines. I think you be better off with vMware Data Protection which is free, the downside to this is that your need a recommended 1.5TB of free space but the benefits out-way the sacrifice in storage
vmrun will do what vmware-cmd did. It's found with ESX, Workstation, and Server.