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)"}

11 thoughts on “Setting MMU for your VMs”

  1. 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).

  2. 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 😉

  3. 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

    1. 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.

Leave a Reply