Short tip: Changed Block Tracking PowerCLI Cmdlet

Changed Block Tracking (CBT) enables creating incremental backups of virtual machines. In comparison with conventional VM backups, guest hard drives are synchronized. Using CBT, the hypervisor detects changed blocks and the backup software will only store these blocks. Unfortunately these are some vSphere and backup software verions that have problems with CBT and it might be necessary from time to time to reset CBT. This mostly means manual effort as CBT settings need to be reset by virtual disk. Unitrends published some PowerCLI Cmdlets simplifying CBT management on GitHub.

Before starting, ensure that your PowerShell execution policy allows loading external Cmdlets, e.g.:

1PowerCLI C:\scripts> Set-ExecutionPolicy Bypass
2PowerCLI C:\scripts> .\UnitrendsCBT.ps1

Also, make sure that you have established a connection to a vCenter server or ESXi host:

1PowerCLI C:\scripts> Connect-VIServer -Server vcenter.localdomain.loc

Utilize the Get-CBT command to see CBT state:

1PowerCLI C:\scripts> Get-VM giertz01|Get-CBT
3Name     PowerState CbtEnabled
4---- ---------- ----------
5GIERTZ01 PoweredOn        True

For enabling/disabling CBT, use one of the following commands:

1PowerCLI C:\scripts> Get-VM giertz01|Enable-CBT
2PowerCLI C:\scripts> Get-VM giertz01|Disable-CBT

Using Reset-CBT it is possible to reset CBT. This will change VM settings and also create/remove a snapshot:

1PowerCLI C:\scripts> Get-VM giertz01|Reset-CBT
2[*] GIERTZ01 : OK

For troubleshooting purposes it might be necessary to retrieve the CBT ``change ID`. Utilize the following command for this:

1PowerCLI C:\scripts> Get-VM giertz01|Get-ChangeId
2[*] GIERTZ01 -> 52 83 47 44 9d 51 f8 fc-aa 6f 6c fb da 57 bd a9/3