commands

^

Set-DbaPowerPlan

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows only

 

Synopsis

Sets the SQL Server OS's Power Plan.

Description

Sets the SQL Server OS's Power Plan. Defaults to High Performance which is best practice.

If your organization uses a custom power plan that is considered best practice, specify -CustomPowerPlan.

References: https://support.microsoft.com/en-us/kb/2207548 http://www.sqlskills.com/blogs/glenn/windows-power-plan-effects-on-newer-intel-processors/

Syntax

Set-DbaPowerPlan
    [[-ComputerName] <DbaInstanceParameter[]>]
    [[-Credential] <PSCredential>]
    [[-PowerPlan] <String>]
    [[-CustomPowerPlan] <String>]
    [[-InputObject] <PSObject[]>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

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

Sets the Power Plan to High Performance. Skips it if its already set.

Example: 2
PS C:\> Set-DbaPowerPlan -ComputerName sql2017 -PowerPlan Höchstleistung

Sets the PowerPlan on a German system to Höchstleistung.
We use the English phrase "High Performance" by default. To specify Power Plans in another language, use the -PowerPlan parameter.

Example: 3
PS C:\> 'Server1', 'Server2' | Set-DbaPowerPlan -PowerPlan Balanced

Sets the Power Plan to Balanced for Server1 and Server2. Skips it if its already set.

Example: 4
PS C:\> $cred = Get-Credential 'Domain\User'
PS C:\> Set-DbaPowerPlan -ComputerName sql2017 -Credential $cred

Connects using alternative Windows credential and sets the Power Plan to High Performance. Skips it if its already set.

Example: 5
PS C:\> Set-DbaPowerPlan -ComputerName sqlcluster -CustomPowerPlan 'Maximum Performance'

Sets the Power Plan to the custom power plan called "Maximum Performance". Skips it if its already set.

Optional Parameters

-ComputerName

The server(s) to set the Power Plan on.

Alias
Required False
Pipeline true (ByValue)
Default Value
-Credential

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

Alias
Required False
Pipeline false
Default Value
-PowerPlan

Specifies the Power Plan that you wish to use. We use the English phrase "High Performance" by default. To specify Power Plans in another language, use this parameter (-PowerPlan Höchstleistung).

Alias
Required False
Pipeline false
Default Value High Performance
-CustomPowerPlan

Specifies the name of a custom Power Plan to use.

Alias
Required False
Pipeline false
Default Value
-InputObject

Enables piping from Get-DbaPowerPlan

Alias
Required False
Pipeline true (ByValue)
Default Value
-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.

Alias
Required False
Pipeline false
Default Value False
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value

 

Want to see the source code for this command? Check out Set-DbaPowerPlan on GitHub.
Want to see the Bill Of Health for this command? Check out Set-DbaPowerPlan.