Hi,
i need script to set the following ESX-Host-Parameters:
Numa.PageMigEnable = 0
CPU.HaltingIdleMsecPenalty = 5000
I have to do this on more than 100 Host so i would like to use a script....
Is there still a script which i can use?
Thx in advance
Chakoe
Hi Chakoe,
You can use the Set-VMHostAdvancedConfiguration cmdlet to set the Numa.PageMigEnable and CPU.HaltingIdleMsecPenalty values. Something like this:
Get-VMHost | ForEach-Object { Set-VMHostAdvancedConfiguration -VMHost $_ -Name Numa.PageMigEnable -Value 0 Set-VMHostAdvancedConfiguration -VMHost $_ -Name CPU.HaltingIdleMsecPenalty -Value 5000 }
If you have to set multiple values the next script will be faster:
$NameValues = @{"Numa.PageMigEnable" = 0; "CPU.HaltingIdleMsecPenalty" = 5000} Get-VMHost | Set-VMHostAdvancedConfiguration -NameValue $NameValues
Although I get an error stating 'CPU.HaltingIdleMsecPenalty' is invalid or exceeds the maximum number of characters permitted. Maybe a typo?
Regards, Robert
Message was edited by: RvdNieuwendijk
Hi,
Max val is 80,000
Maybe a problem in writing the value ( format oder "" "" )?
I get the next error running the script from my previous post using PowerCLI 4.1 connected to a vCenter 4.1 Server against an ESX 4.1 or ESXi 4.1 host:
Set-VMHostAdvancedConfiguration : 3-8-2010 15:33:26 Set-VMHostAdvancedConfiguration 'CPU.HaltingIdleMsecPenalty' is invalid or ex ceeds the maximum number of characters permitted. At line:3 char:34 + Set-VMHostAdvancedConfiguration <<<< -VMHost $_ -Name CPU.HaltingIdleMsecPenalty -Value 5000 + CategoryInfo : NotSpecified: (:) [Set-VMHostAdvancedConfiguration], InvalidName + FullyQualifiedErrorId : Client20_MoServiceImpl_Invoke_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.SetVMHostAdvancedCon figuration [vSphere PowerCLI] C:\users\robert> $error[0] Set-VMHostAdvancedConfiguration : 3-8-2010 15:33:26 Set-VMHostAdvancedConfiguration 'CPU.HaltingIdleMsecPenalty' is invalid or ex ceeds the maximum number of characters permitted. At line:3 char:34 + Set-VMHostAdvancedConfiguration <<<< -VMHost $_ -Name CPU.HaltingIdleMsecPenalty -Value 5000 + CategoryInfo : NotSpecified: (:) [Set-VMHostAdvancedConfiguration], InvalidName + FullyQualifiedErrorId : Client20_MoServiceImpl_Invoke_ViError,VMware.VimAutomation.ViCore.Cmdlets.Commands.Host.SetVMHostAdvancedCon figuration [vSphere PowerCLI] C:\users\robert> $error[0].Exception 3-8-2010 15:33:26 Set-VMHostAdvancedConfiguration 'CPU.HaltingIdleMsecPenalty' is invalid or exceeds the maximum number of charac ters permitted. [vSphere PowerCLI] C:\users\robert> $error[0].Exception.InnerException 'CPU.HaltingIdleMsecPenalty' is invalid or exceeds the maximum number of characters permitted. [vSphere PowerCLI] C:\users\robert>
Maybe someone from VMware can comment on this?
Nothing wrong with the cmdlet as far as I can tell.
Just have to remember that these advanced parameters are case-sensitive.
This works for me
$NameValues = @{"Numa.PageMigEnable" = 0; "Cpu.HaltingIdleMsecPenalty" = 5000} Get-VMHost | Set-VMHostAdvancedConfiguration -NameValue $NameValues
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
if i run this script against one test-ESX ( 4.0.0 buil 244038) i get the following error:
A spcified parameter was not correct.
The script sets Numa.PageMigEnable correctly, but
<code>"Cpu.HaltingIdleMsecPenalty" = 5000</code> does not work correctly.
Any idea?
Works for me against ESX 261974.
Can you check if you can set the value from the vSphere client ?
And from the cmdline (see KB1020233.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Luc's version works for me.
Hi,
i can set the value in cmdline.
But i cannot set it in the VSphere Client ( which is Version 4.0.0 build 208111 / vCenter is same )
Greets
Chakoe
I assume you're connected to the vCenter when you ran the script.
Can you try to connect to the ESX server and then run the script ?
Looks like that vCenter build doesn't support the parameter.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
this might be a newbie-question, but i don´t know how to connect
to a esx directly in PowerCLI
In the past, i´ve always been connected to the vCenter by using "connect-viserver "
Btw: I tried to connect to the esx directly using the vSphere-Client, but i also can´t see the parameter there...
Same cmdlet, but use the hostname of the ESX server and pass credentials that are defined on the ESX server (for example root and the root password).
Connect-VIServer -Server <esx-hostname> -User <ESX-account> -Password <ESX-password>
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi,
using the script connected directly to the ESX-Server does not work. Same error.
Script:
$NameValues = @{"Numa.PageMigEnable" = 0; "Cpu.HaltingIdleMsecPenalty" = 5000}
Get-VMHost | Set-VMHostAdvancedConfiguration -NameValue $NameValues
Out:
04.08.2010 10:43:22 Set-VMHostAdvancedConfiguration A specified parameter was not correct.
At :line:2 char:44
+ Get-VMHost | Set-VMHostAdvancedConfiguration <<<< -NameValue $NameValues
Name Value
-
-
Numa.PageMigEnable
Could be that the parameter doesn't work with the ESX build you are using.
I have the impression the parameter only functions since ESX 4u2 (build 261974) but perhaps you better ask in the VMware ESX™ 4 community.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference