Hi
I want to set the config on all VM's that have a specific tag.
Basically want to work through all the vm's on each host on each cluster at each site. check if the vm has a specific tag say "DOME" and then I want to set the latency sensitivity setting to high. I also want to set the resource schedule to high for CPU and say set the min value to 200 and also lock the vm entire memory.
I have installed powerCLI v6, but have VC 5.5u2. just starting the upgrade process to V6
Thanks
Alex
It sets the CPU shares to high locks the memory, and sets the latency to high. This assumes the tag category is 'DOME' and whichever tag that has that category will be associated with that VM
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.MemoryReservationLockedToMax = $true
$spec.LatencySensitivity = New-Object VMware.Vim.LatencySensitivity
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high
Get-VM | where { ($_ | Get-TagAssignment -Category 'Dome') } | foreach {
$vm = $_
$vm | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CpuSharesLevel High
(Get-VM $vm).extensiondata.ReconfigVM_Task($spec)
}
What is the 200 reservation? Do you mean the "MHz" reservation?
I wish I could take full credit. I saw past posts from LucD for setting some of these, I just combined them.
It sets the CPU shares to high locks the memory, and sets the latency to high. This assumes the tag category is 'DOME' and whichever tag that has that category will be associated with that VM
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.MemoryReservationLockedToMax = $true
$spec.LatencySensitivity = New-Object VMware.Vim.LatencySensitivity
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high
Get-VM | where { ($_ | Get-TagAssignment -Category 'Dome') } | foreach {
$vm = $_
$vm | Get-VMResourceConfiguration | Set-VMResourceConfiguration -CpuSharesLevel High
(Get-VM $vm).extensiondata.ReconfigVM_Task($spec)
}
What is the 200 reservation? Do you mean the "MHz" reservation?
I wish I could take full credit. I saw past posts from LucD for setting some of these, I just combined them.
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high
Is there a way to list the particular levels of latency sensitivity level? How did you know that high was an option here for example
LucD posted this for a similar question: Re: Powercli for Latency Sensitivity?
If you create these objects
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.LatencySensitivity = New-Object VMware.Vim.LatencySensitivity
You can see the setting for the levels here:
$spec.LatencySensitivity.Level = [VMware.Vim.LatencySensitivitySensitivityLevel]::high # right after the two colons, while you're typing, you should get an intellisense prompt for your options. You probably need to make sure you're using an ISE, and not just the PS prompt. I'm using PowerGUI.
Hi
One question, don't you have to read the extension data first and then set it to $spec. or do uninitialised values not flow through ?