Thor Logo dbatools

Get-DbaPowerPlan

View Source
Chrissy LeMaire (@cl), netnerds.net
Windows, Linux, macOS

Synopsis

Retrieves Windows Power Plan configuration from SQL Server hosts to verify High Performance settings.

Description

Checks the active Windows Power Plan configuration on SQL Server host computers to ensure they follow performance best practices. SQL Server performance can be significantly impacted by power management settings that throttle CPU frequency or put processors to sleep during idle periods.

By default, returns the currently active power plan for each specified computer. Use the -List parameter to view all available power plans and their status. Microsoft recommends using the “High Performance” power plan for SQL Server hosts to prevent CPU throttling and ensure consistent database performance.

Syntax

Get-DbaPowerPlan
    [-ComputerName] <DbaInstanceParameter[]>
    [[-Credential] <PSCredential>]
    [-List]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaPowerPlan -ComputerName sql2017

Gets the Power Plan settings for sql2017

Example: 2
PS C:\> Get-DbaPowerPlan -ComputerName sql2017 -Credential ad\admin

Gets the Power Plan settings for sql2017 using an alternative credential

Example: 3
PS C:\> Get-DbaPowerPlan -ComputerName sql2017 -List

Gets all available Power Plans on sql2017

Required Parameters

-ComputerName

Specifies the SQL Server host computer(s) to check for Windows Power Plan configuration. Accepts multiple server names for bulk power plan auditing.
Use this to verify that your SQL Server hosts are configured with the recommended “High Performance” power plan instead of “Balanced” or “Power Saver” modes that can throttle CPU performance.

PropertyValue
Alias
RequiredTrue
Pipelinetrue (ByValue)
Default Value

Optional Parameters

-Credential

Specifies a PSCredential object to use in authenticating to the server(s), instead of the current user account.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default Value
-List

Returns all available power plans on the target computers instead of just the currently active plan. Shows the status of each plan including which one is active.
Use this when you need to see all power plan options available on a server before making configuration changes or to audit power plan availability across your environment.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with “sea of red” exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this “nice by default” feature off and enables you to catch exceptions with your own try/catch.

PropertyValue
Alias
RequiredFalse
Pipelinefalse
Default ValueFalse