Thursday, March 29, 2012

Disabling or Enabling VMware Change Block Tracking (CBT) using PowerShell and PowerCLI

Recently I experimented with using the VMware specific backup technologies with a number of vendor products.  None of those technologies compared favorably to the simplicity of NetApp SnapMirror + NDMP when using NFS, but the solutions were vastly better than the old VCB based ones.  I could see using them in an environment that leveraged iSCSI or local storage.

After the POC I wanted to disable VMware Change Block Tracking on my non-production VMs.  I’ve run into one bug around CBT and would rather not leave it turned on without a reason.  It is simple to set the value using PowerShell, but to get it to take effect you need to power off the VM or take a snapshot.  Here is my solution:

Get the VMs with CBT enabled:

$vms=get-vm | ?{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}

Create a VM Specification to apply with the desired setting:

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.ChangeTrackingEnabled = $false

Apply the specification to each VM, then create and remove a snapshot:

foreach($vm in $vms){
$snap=$vm | New-Snapshot -Name 'Disable CBT'
$snap | Remove-Snapshot -confirm:$false}

Check for success:

get-vm | ?{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}


  1. Thanks for sharing this tips man, does it cause any VM downtime or problem when the VMis running in production ?

  2. Nice script, if a big corp though it was any good then I'd have the confidence to use it... oh, hang on...

  3. Not that I care but as BENJ's post is what I found, and what I used, but: BENJ's post is dated 29th March 2012. The "Anonymous" post above, from October 29th 2014, links to a Veeam KB article created on 27/10/ my reckoning, that's 2 1/2 years after original post. So, I'm not sure that "busted" really covers it, unless you were referring to the fact a "big corp *thought* (I corrected your spelling mistake for you) it was any good", did so a considerable time later?

    Or am I missing something?