Created
July 5, 2010 13:42
-
-
Save jbarber/464358 to your computer and use it in GitHub Desktop.
Set VM advanced options (stop ballooning)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VMware: set the advanced configuration option sched.mem.maxmemctl to zero to prevent ballooning | |
function deballoon ($vmname) { | |
# Set "sched.mem.maxmemctl" to 0 | |
$opt = new-object Vmware.Vim.OptionValue -Property @{ Key = "sched.mem.maxmemctl"; Value = 0 } | |
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec | |
$vmConfigSpec.extraconfig += $opt | |
# Use a filter to find a particular VM | |
$vm = get-view -viewtype "VirtualMachine" -filter @{ "Name" = $vmname } | |
# And update the config on the server | |
$vm.ReconfigVM( $vmConfigSpec ) | |
} | |
connect-viserver -server virtualcenter -credential (Get-Credential (Get-Item env:username).value) | |
deballoon( "vm-name" ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment