Genz
Rajesh Radhakrishnan
06/02/2018 Published 3 weeks ago
Share
https://vmarena.com/wp-content/uploads/2024/11/gradient-website-hosting-illustration_23-2149246882-1.jpg

CBT Management with Power CLI

List all virtual machines where CBT enabled 

Get-VM| Where-Object{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}

Check specific virtual machines where CBT enabled 

Get-VM  “TEST-VM-01” | Where-Object{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}


List all virtuals machine where CBT disabled

Get-VM| Where-Object{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $false}

Check specific virtual machines where CBT disabled

Get-VM  “TEST-VM-01” | Where-Object{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $false}

Note : In GUI mode we cannot modify the CBT configuration while virtual machine is powered on , so we can use below script to enable or disable CBT in VM powered on state.

Script to enable CBT

$vmtest = Get-VM TEST-VM-01 | get-view
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.changeTrackingEnabled = $true
$vmtest.reconfigVM($vmConfigSpec)

Script to disable CBT

$vmtest = Get-VM TEST-VM-01 | get-view
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.changeTrackingEnabled = $disabale
$vmtest.reconfigVM($vmConfigSpec)

You may use the above commands by pasting on vSphere CLI after connecting to vCenter   or  save it as .PS1  extension and run from the directory