Skip to content

Instantly share code, notes, and snippets.

@vMarkusK
Last active June 15, 2016 21:25
Show Gist options
  • Save vMarkusK/0de7b009458fdc255c572049ea3a0838 to your computer and use it in GitHub Desktop.
Save vMarkusK/0de7b009458fdc255c572049ea3a0838 to your computer and use it in GitHub Desktop.
Fix for Snapshot consolidation in VMware ESXi 5.5.x and ESXi 6.0.x
Function Set-ConsolidationFix {
[cmdletbinding()]
param (
#[parameter(Mandatory=$true)]
[parameter(Mandatory=$true,ValueFromPipeline=$true)]
[VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine]$myVM,
[parameter(Mandatory=$true)]
[string]$Fix = "Timeout" # Timeout or Stun
)
Process {
if ($Fix -like "Timeout") {
$MyVM | New-AdvancedSetting -Name snapshot.asyncConsolidate.forceSync -Value TRUE -Confirm:$False -Force:$True
$MySnap = $MyVM | New-Snapshot -Name "ConsolidationFix"
$MySnap | Remove-Snapshot -confirm:$false
}
elseif ($Fix -like "Stun") {
$MyVM | New-AdvancedSetting -Name snapshot.maxConsolidateTime -Value 30 -Confirm:$False -Force:$True
$MySnap = $MyVM | New-Snapshot -Name "ConsolidationFix"
$MySnap | Remove-Snapshot -confirm:$false
}
else {
Write-Error "No Valid Fix"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment