WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Resources
    • Nested Virtualization
  • VMware Nostalgia
  • Apple
You are here: Home / Uncategorized / Configuring ESXi Power Management Policy Using the CLI

Configuring ESXi Power Management Policy Using the CLI

08.18.2012 by William Lam // 12 Comments

An interesting question on the VMTN forum caught my eye today, which was around configuring ESXi's Power Management Policy using the command-line via a kickstart script. I found this question to be interesting as I never had to tweak this configuration and was curious myself to see how you might be able to perform this via the command-line as I never recall seeing a command relating to the power management settings.

After a few minutes of digging, I found that the standard set of CLI's such as ESXCLI, vim-cmd, etc. do not provide a way to configure ESXi's power management settings but did find it was possible using my other favorite "not officially supported" CLI called vsish. Now, you can of course create a remote script using the vSphere API to configure this setting, but if you are looking to modify this within a kickstart script, this is route you will want to take.

UPDATE (01/12/15) - I just found out today from Engineering that it is possible to configure ESXi power management policy using ESXCLI. Though the parameters are currently set to hidden, you can use the following command to set the appropriate policy based on your enviornment.

esxcli system settings advanced set --option=/Power/CpuPolicy --string-value="High Performance"

UPDATE (11/04/14) - It turns out configuration changes made directly through vsish do not persist after a reboot, this might be problematic for most of you 😉 Luckily, Alan Castonguay who works in our GSS organization reached out and created a nice pyvmomi (vSphere SDK or Python) script that can be executed in the ESXi shell and of course it can easily be integrated into a Kickstart script. I have tested his sample script to verify its functionality and have also checked it into my Github repository so that others can benefit from. You can download the script which I have named configure_esxi_power_policy.py

If you run the script without any arguments, it will display the current power policy that has been enabled as seen in the screenshot below:

configure-esx-power-policy-0
To change the policy, you will need to specify the "shortName" power policy, in this example I want to change it from "static" to "low":

configure-esx-power-policy-1
To check whether your ESXi host supports power management, run the following command:

~ # vsish -e get /power/hardwareSupport
Hardware power management support {
CPU power management:Enhanced Intel SpeedStep(R)
Memory power management:Not available
}

To view the current power management setting, run the following command:

~ # vsish -e get /power/currentPolicy
Host power management policy {
ID: 2
Short name:dynamic
Long name:Balanced
Description:Reduce energy consumption with minimal performance compromise
}

Just like the vSphere Client, you have 4 options which maps to the "ID" property as seen above. You can get more details by querying each of the policy (1-4), here is an example:

~ # vsish -e get /power/policy/1
Host power management policy {
ID: 1
Short name:static
Long name:High Performance
Description:Do not use any power management features
}

Here's a quick table that maps the policy ID to power management policy which is the same order as shown in the vSphere Client:

Policy ID Power Management Policy
1 High Performance
2 Balanced
3 Lower Power
4 Custom

To change the power management policy, run the following command:

~ # vsish -e set /power/currentPolicy 1

So now you can integrate power management settings in your ESXi kickstart script for automated deployment and configurations!

More from my site

  • Quick Tip - Using ESXi to send Wake-on-Lan (WoL) packet
  • Verify Hypervisor-Assisted Guest Mitigation (Spectre) patches using PowerCLI
  • Quick Tip - "poor mans" history command in ESXi
  • List of VMware CLIs, SDKs & DevOps Tools
  • How to clear the ARP cache in ESXi prior to vSphere 5.5

Categories // Uncategorized Tags // cli, power management, power policy, vsish

Comments

  1. *protectedNiTRo says

    08/18/2012 at 7:24 pm

    And here is the *supported* powerCLI way http://www.hypervisor.fr/?p=3422 🙂
    Very interesting post as usual.

    Reply
    • *protectedWilliam says

      08/18/2012 at 7:29 pm

      @Nitro,

      Thanks, but the key was "kickstart" script, meaning no remote commands. I definitely could have written a simple script leveraging the API 🙂

      Reply
    • *protectedAnonymous says

      09/06/2012 at 1:36 pm

      Hi William,
      The command works fine in scripts(KS) but after rebooting the server the currentPolicy is reversed to "Balanced".

      Regards Denis

      Reply
    • *protectedWilliam says

      09/06/2012 at 11:36 pm

      Can you try to run the command & then run /sbin/auto-backup.sh and see if that persists the change after a system reboot?

      Reply
  2. *protectedAnonymous says

    09/07/2012 at 9:49 am

    Hi William,
    It does not help!
    It's work only when you make the change trough the "vSphere client".
    Do we have a another way to set it in our scripts?

    Best Regards
    Denis

    Reply
  3. *protectedchristy says

    02/13/2013 at 4:03 pm

    Hi
    Thanks for this ticket!
    In general, people are talking about setting a specific power management policy. Please, is it possible to retrieve the current processor frequency at runtime in VMware?With other hypervisors, they generally offer a "command"/ way to do it!
    Thanks for your reply!!

    Reply
  4. *protectedAnonymous says

    06/20/2013 at 9:09 am

    Hi William

    Thanks for this. As mentioned by a previous commenter the setting does not survive a host reboot when configured this way, even when running the autobackup script afterwards. Has anything changed with 5.1 Update 1? Seems like a prime candidate for a fire-and-forget line in a kix build script if it could be made to persist!

    D

    Reply
  5. *protectedDavid Warner says

    09/30/2013 at 4:51 pm

    WOW!! terribly informative web log and helpful techniques. Please visit this web site if you wish a lot of detail
    it management services Indianapolis

    Reply
  6. *protected*protected email* says

    04/24/2018 at 1:54 am

    Doesn’t work in 6.5

    Reply
    • *protectedBen says

      02/03/2020 at 6:07 pm

      Or in 6.7. William, is there a new way to set this?

      Reply
      • *protectedLuca Rizzo says

        09/11/2020 at 2:27 pm

        Apparently 6.7 adds a few new commands in esxcli, assuming that you might want to set the High performance mode you could run:

        esxcli hardware power policy set --short-name static

        These are the new commands:
        esxcli hardware power policy choices list
        esxcli hardware power policy get
        esxcli hardware power policy set

        and these are the policies:
        Id Short name Name
        -- ---------- ----------------
        1 static High Performance
        2 dynamic Balanced
        3 low Low Power
        4 custom Custom

        Reply

Trackbacks

  1. Esxi Host Power Management Policies in vSphere 6 – Virtual Reality says:
    11/19/2017 at 11:04 pm

    […] Configuring ESXi Power Management Policy Using the CLI […]

    Reply

Leave a Reply to *protected email*Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Programmatically accessing the Broadcom Compatibility Guide (BCG) 05/06/2025
  • Quick Tip - Validating Broadcom Download Token  05/01/2025
  • Supported chipsets for the USB Network Native Driver for ESXi Fling 04/23/2025
  • vCenter Identity Federation with Authelia 04/16/2025
  • vCenter Server Identity Federation with Kanidm 04/10/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...