SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Recently Changed Pages:

View All Pages


View All Tags


LinkedIn




WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Pages with comments

View All Comments

windowspowerplan

Windows PowerPlan

The windows powerplan is set to balanced by default in Windows Server 2008/R2, but that could seriously impact performance. And, because idle CPUs in virtual environments don't use much power anyway, especially in virtual environments, it could be better to change this setting to High Performance:

  • Go to the Control Panel → Hardware → Choose a power plan
  • Click on “Change settings that are currently unavailable”
  • Set to “High Performance”

Getting the PowerPlan for Windows with PowerShell

If you want to know the powerplan your servers are running you can use this powershell script:

# Source http://sirsql.net/blog/2011/5/2/checking-windows-power-plans-with-powershell.html
 
Function Get-PowerPlan ($Computer)
{
    # Grab the windows version so we know whether to query for the power plan or not
    $winver = gwmi -Class win32_OperatingSystem -ComputerName $Computer
        # Version 6x is Win7/2008 powerplan not relevant below that
        if ($winver.Version.substring(0,1) -gt 5)
        {
            $plan = Get-WmiObject -Class win32_Powerplan -Computername $Computer -Namespace root\cimv2\power -Filter "isActive='true'"
            $regex = [regex]"{(.*?)}$"
            $planGuid = $regex.Match($plan.instanceID.Tostring()).groups[1].value
            $PlanType = powercfg -query $planGuid
 
            # Grab just the first record which has the actual plan being used
            # From that record just grab the actual plan type which is enclosed in parenthesis
            $PlanType = $PlanType[0].Substring($PlanType[0].LastIndexOf("(")+1) -replace "\)", ""
 
            # If the plan isn't high performance let's make it stand out
            if ($PlanType -ne "High performance") { Write-Host $Computer":" $PlanType.ToUpper() -foregroundcolor "Red" }
            else {  Write-Host $Computer":" $PlanType -foregroundcolor "Green" }
        }
        else
        {
            # If the Windows version doesn't support power plans just let us know
            Write-Host $Computer": n/a"
        }
}
 
#Based upon a list of machines contained in c:\temp\serverlist.txt
get-content C:\temp\serverlist.txt | %  {  Get-PowerPlan $_ ; }

Note that, if you want to change the powerplan right away the command should be this (works with GUID):

powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

And manually query would be:

C:\Users\sjoerd>powercfg -getactivescheme
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c  (High performance)

Set the PowerPlan through policies

Open gpedit.msc and go to Administrative templates → System → Power management and doubleclick the “Select an Active Power Plan”. Enable the policy and select the high performance policy. Save your changes.
See here on how to create an GPO for your domain so you can set the policy for all of your servers.

Links

You could leave a comment if you were logged in.
windowspowerplan.txt · Last modified: 2021/09/24 00:25 (external edit)