Setting MMU for your VMs
I was asked by my friend Duncan if it was easy enough to set the Memory Management Unit (MMU) for each of his VM’s. Read his post here for more information on what he was working on.
He was about to set this by hand for 50+ VM’s which would take a while, so with the power of the VI Toolkit he can now take it easy whilst PowerShell does the hard work:
For one VM:
Get-VM -Name "MyVM" | Get-View | foreach { $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo $spec.flags.VirtualMMuUsage = "on" $taskMoRef = $_.ReconfigVM_Task($spec) }
For all VMs you could use:
Get-VM | Get-View | foreach { $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo $spec.flags.VirtualMMuUsage = "on" $taskMoRef = $_.ReconfigVM_Task($spec) }
Or for each of the VMs in a cluster:
Get-Cluster "MyCluster" | Get-VM | Get-View | foreach { $spec = New-Object VMware.Vim.VirtualMachineConfigSpec $spec.flags = New-Object VMware.Vim.VirtualMachineFlagInfo $spec.flags.VirtualMMuUsage = "on" $taskMoRef = $_.ReconfigVM_Task($spec) }
To list each of the VM’s and their current MMU setting use this one-liner:
Get-VM | Get-View | ForEach {Write "$($_.Name) - $($_.Config.Flags.VirtualMmuUsage)"}
VMTN: Ask The Experts – How did it Go ? UK VM User Group – London











Quick question comes to my mind…
How do you tell the actual state of the virtualized MMU ?
Sure by default it is set to ‘Allow the host….’ but then is it ON or OFF ?
Thx
Thats a very good question, one unfortunatly I do not know the answer for, you can list from the vm side of things what that option is set too but im guessing the actual detection would need to be done from inside the guest OS, I wonder how you can tell ? I will have a look.
[...] setting needs to be set to force other wise it will not be utilized. (Alan Renouf was so kind to write a couple of lines of Powershell that enabled this feature for a specific VM, Cluster or just every single VM you have. Thanks [...]
Ahhh, Duncan has just answered the question….. “we also wanted to test with “virtualized MMU” set to forced. For a 32Bit Windows OS this setting needs to be set to force other wise it will not be utilized.”
http://www.yellow-bricks.com/2009/03/06/virtualized-mmu-and-tp/
Thanks Duncan
Yup he came back to me on VMware Communities as well.
BTW how would you do to test first if guest is a w32bit rather than x64bit one ?
Thx
I have adjusted the post to give you a one-liner which will list there current setting.
[...] 2009 Published in Management & Automation, Server Last week the well known powershell guru Alan Renouf helped me out with a script for enabling virtualized MMU. This week I needed to set [...]
To see which settings are actively in use, you need to grep “HV Setting” against the vmware.log file for the VM. You will have to run it from the host that the VM runs on. http://dferguson75.wordpress.com has the details (I’d copy/paste them but there’s a web filter preventing my access to the site currently).