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

User Tools

Site Tools


This shows you the differences between two versions of the page.

Link to this comparison view

windowspowerplan [2013/04/20 10:15] (current)
sjoerd created
Line 1: Line 1:
 += 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:
 +<code powershell>​
 +# Source http://​​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 [[adpasswordpolicy|here]] on how to create an GPO for your domain so you can set the policy for all of your servers. ​
 += Links =
 +[[http://​​kb/​2207548|Micrsofts KB article]] \\
 +[[http://​​2011/​06/​windows-20082008-r2-default-power-plan-of-balanced-can-increase-latency-and-reduce-throughput/​|A Windows Azure view with some more background information]] \\
 +[[http://​​en-us/​library/​cc748940%28v=ws.10%29.aspx|Powercfg command line options]] \\
 +{{tag>​windows performance scripts gpo}}
windowspowerplan.txt ยท Last modified: 2013/04/20 10:15 by sjoerd