Skip to content

Instantly share code, notes, and snippets.

@tomtorggler
Created October 13, 2016 19:57
Show Gist options
  • Save tomtorggler/f8197a70ad762a38be198bacca0b39d4 to your computer and use it in GitHub Desktop.
Save tomtorggler/f8197a70ad762a38be198bacca0b39d4 to your computer and use it in GitHub Desktop.
function Set-VmNestedHVStatus {
param($VM,[bool]$NestedHVStatus)
foreach ($item in $VM) {
try {
$vm = Get-VM $item
$spec = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec
$spec.ChangeVersion = $vm.ExtensionData.Config.ChangeVersion
$spec.NestedHVEnabled = $NestedHVStatus
$vm.ExtensionData.ReconfigVM($spec)
} catch {
Write-Warning -Message $_
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment