Today I received a question in my mailbox about setting the CPU Identification Mask on Multiple VM’s. The guy who asked the question wanted to set the following values:
So I started to search on the VMware Communities and I found the following function.
# Mask SSE 4.1 Extensions to the guest. function Mask-Extensions($vm) { $view = get-view $vm.id $vmConfigSpec = new-object VMware.Vim.VirtualMachineConfigSpec $featureMask = new-object VMware.Vim.VirtualMachineCpuIdInfoSpec $featureMask.info = new-object VMware.Vim.HostCpuIdInfo $featureMask.info.ecx = "---- ---- ---- 0--- ---- ---- ---- ----" $featureMask.info.level = 1 $vmConfigSpec.CpuFeatureMask = $featureMask $view.ReconfigVM($vmConfigSpec) }
I changed it a little bit, so it matches the required settings (see picture above):
function Mask-Extensions($vm) { $view = get-view $vm.id write-host "Setting Mask for: "$vm.Name $vmConfigSpec = new-object VMware.Vim.VirtualMachineConfigSpec $featureMask = new-object VMware.Vim.VirtualMachineCpuIdInfoSpec $featureMask.info = new-object VMware.Vim.HostCpuIdInfo $featureMask.info.eax = "-----------------------------000" $featureMask.info.level = 0 $vmConfigSpec.CpuFeatureMask = $featureMask $view.ReconfigVM($vmConfigSpec) }
If you want to run this function against one VM, You can run the following command:
Mask-Extensions (get-vm "My VM")
You can also use this function in the pipeline:
get-vm | % {Mask-Extensions ($_)}
Hey there,
is there any way to combine ScheduledTaskManage script and alarmspec.setEnabled(true) to create a schedule task that enables/disables an alarm for a give period?
I’ve been lloking at http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/visdk25programmingguide.pdf and other doco’s, but no joy so far.
Thanks a mill!
Shane.
Thanks for this function. I can really use this in my situation. One additional question though, how would I write the script so that it displays the current CPU ID mask?
Thanks,
Jonathan