Author | Chrissy LeMaire (@cl), netnerds.net |
Availability | Windows, Linux, macOS |
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.
Sets the SQL Server OS's Power Plan.
Sets the SQL Server OS's Power Plan. Defaults to High Performance which is best practice.
If your organization uses a different power plan that is considered best practice, specify -PowerPlan.
References:
https://support.microsoft.com/en-us/kb/2207548
http://www.sqlskills.com/blogs/glenn/windows-power-plan-effects-on-newer-intel-processors/
Set-DbaPowerPlan
[-ComputerName] <DbaInstanceParameter[]>
[[-Credential] <PSCredential>]
[[-PowerPlan] <String>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> Set-DbaPowerPlan -ComputerName sql2017
Sets the Power Plan to High Performance. Skips it if its already set.
PS C:\> 'Server1', 'Server2' | Set-DbaPowerPlan -PowerPlan Balanced
Sets the Power Plan to Balanced for Server1 and Server2. Skips it if its already set.
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.
PS C:\> Set-DbaPowerPlan -ComputerName sqlcluster -PowerPlan 'Maximum Performance'
Sets the Power Plan to "Maximum Performance". Skips it if its already set.
PS C:\> Get-DbaPowerPlan -ComputerName oldserver | Set-DbaPowerPlan -ComputerName newserver1, newserver2
Uses the Power Plan of oldserver as best practice and sets the Power Plan of newserver1 and newserver2 accordingly.
The server(s) to set the Power Plan on.
Alias | |
Required | True |
Pipeline | true (ByValue, ByPropertyName) |
Default Value |
Specifies a PSCredential object to use in authenticating to the server(s), instead of the current user account.
Alias | |
Required | False |
Pipeline | true (ByPropertyName) |
Default Value |
If your organization uses a different Power Plan that's considered best practice, specify it here.
Use Get-DbaPowerPlan -List to get all available Power Plans on a computer.
Alias | CustomPowerPlan,RecommendedPowerPlan |
Required | False |
Pipeline | true (ByPropertyName) |
Default Value |
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 |
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 |
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 |