Get Power Management Settings
Applicability:
SQL Server 2000: N/A
SQL Server 2005: Tested
SQL Server 2008: Tested
SQL Server 2008R2: Tested
SQL Server 2012: Tested
SQL Server 2014: Tested
SQL Server 2016: Tested
SQL Server 2017: Tested
Credits:
Author: ChillyDBA
Date: 8 Jun 2020
Description
Returns the SQL Server power management scheme name
Not so critical in these days of Virtual-Everything, but useful nonetheless
Code
DECLARE
@value VARCHAR(64),
@key VARCHAR(512) = 'SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\'
+ 'ControlPanel\NameSpace\{025A5937-A6BE-4686-A844-36FE4BEC8B6D}';
EXEC master..xp_regread
@rootkey = 'HKEY_LOCAL_MACHINE',
@key = @key,
@value_name = 'PreferredPlan',
@value = @value OUTPUT;
SELECT
@value AS PowerSchemeGUID
,CASE @Value
WHEN '381b4222-f694-41f0-9685-ff5bb260df2e' THEN 'Balanced'
WHEN '8c5e7fda-e8bf-4a96-9a85-a6e23a8c635' THEN 'High performance'
WHEN 'a1841308-3541-4fab-bc81-f71556f20b4a' THEN 'Power saver'
ELSE 'Unknown'
END AS PowerSchemeDescription
/*
Existing Power Schemes (* Active)
-----------------------------------
Power Scheme GUID: 381b4222-f694-41f0-9685-ff5bb260df2e (Balanced) *
Power Scheme GUID: 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c (High performance)
Power Scheme GUID: a1841308-3541-4fab-bc81-f71556f20b4a (Power saver)
*/
--type powercfg /list at cmd to get the valid list