SolvedPrivate

PowerCLI script to workaround VMWare bug with CBT

Posted on 2014-11-10
7
13 Views
Last Modified: 2016-02-25
Our backup software vendor, VEEAM, has published a PowerCLI script as a workaround for the VMWare CBT bug.  This is it below.  I want to be able to do this one VM at a time.  How would I accomplish this below but change it for one specified VM?

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){
$vm.ExtensionData.ReconfigVM($spec)
$snap=$vm | New-Snapshot -Name 'Disable CBT'
$snap | Remove-Snapshot -confirm:$false}

Check for success:
get-vm | ?{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}
0
Comment
Question by:jpletcher1
  • 4
  • 3
7 Comments
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 40433030
One way, if you do not want to be specific about the VM to work on, is to just take out the first VM found:
# Get only first VM with CBT enabled
$vms=get-vm | ? { $_.ExtensionData.Config.ChangeTrackingEnabled } | select -first 1

Open in new window

Each time you run the script, it will only process a single VM.
There are a lot of other ways we can imagine, like showing all found VMs and allow for choosing one.
0
 

Author Comment

by:jpletcher1
ID: 40433039
Thanks, but I would like to be able to specify the name of the VM.  Could I do a where name is equal to or something like that?  I don't know the actual syntax.
0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 500 total points
ID: 40433055
Use Get-VM -Name ThisIsMyVM to get a specific VM. You can use an asterisk so you do not need to write the name out completely.
In the code it would look like this:
$vms = Get-VM -Name ThisIsMyVM | ? { $_.ExtensionData.Config.ChangeTrackingEnabled }

Open in new window

0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:jpletcher1
ID: 40433172
So can run all these lines together in a script like this for example for "Server1" ?


 $vms=get-vm -name Server1 | ?{$_.ExtensionData.Config.ChangeTrackingEnabled -eq $true}
 $spec = New-Object VMware.Vim.VirtualMachineConfigSpec
 $spec.ChangeTrackingEnabled = $false
 foreach($vm in $vms){
 $vm.ExtensionData.ReconfigVM($spec)
 $snap=$vm | New-Snapshot -Name 'Disable CBT'
 $snap | Remove-Snapshot -confirm:$false}
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 40433224
Correct. If the VM specified has already been processed before, nothing will happen.

But if I read the info for this bug correctly, you should need to do that only once after the 128GB*x size boundary of the VMDK file has been passed, and then re-enable CBT.
0
 

Author Comment

by:jpletcher1
ID: 40433251
Correct, it's a one time thing.  With the new version of VEEAM, if a VM is reconfigured to extend a disk past the 128GB limit, the VEEAM backup software will do this automatically.  But any VMs that were extended previously need to be manually done.

How does the script know if this has already been run on a VM?  I know the script changes CBT to be off, then creates/deletes a snapshot.  Then the VEEAM software re-enabled CBT when it runs.  I'm guessing you were saying this because the script itself leaves CBT disabled, so a re-run would just run and not change anything?
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 40433266
A rerun without running a VEEAM backup should not perform a change - CBT is off, so no result.
After running VEEAM backup (and CBT switched on), there is no indication you already performed the workaround. But since you do all that manually, you should know yourself which VMs are "ok" ;-).
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When converting a physical machine to a virtual machine using VMware vCenter Converter Standalone or vCenter Converter Enterprise, if an adapter type is not selected during the initial customization the resulting virtual machine may contain an IDE d…
Last article we focus in how to VMware: How to create and use VMs TAGs – Part 1 so before follow this article and perform the next tasks, you should read the first article how to create the TAG before using them in Veeam Backup Jobs.
This Micro Tutorial steps you through the configuration steps to configure your ESXi host Management Network settings and test the management network, ensure the host is recognized by the DNS Server, configure a new password, and the troubleshooting…
This video shows you how to use a vSphere client to connect to your ESX host as the root user. Demonstrates the basic connection of bypassing certification set up. Demonstrates how to access the traditional view to begin managing your virtual mac…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now