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.:

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

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

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

Utilize the Get-CBT command to see CBT state:

PowerCLI C:scripts> Get-VM giertz01|Get-CBT

Name     PowerState CbtEnabled
----     ---------- ----------
GIERTZ01 PoweredOn        True

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

PowerCLI C:scripts> Get-VM giertz01|Enable-CBT
PowerCLI 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:

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

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

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

Sharing is caring

Leave a Reply