permission denied by powercfg on win7 while an administrator

Solution 1:

The power configuration data is stored in the Registry, but all power management is done through the Power service, not with direct Registry access. To determine whether a given user has the authority to perform a power-related operation, the Power service consults a security descriptor that's also stored in the Registry, specifically in this key:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\SecurityDescriptors

The ACLs are in SDDL format. For me on a working Windows 10 installation, that key has two values. 0E796BDB-100D-47D6-A2D5-F7D2DAA51F51 contains this string:

O:BAG:SYD:P(A;CI;KR;;;BU)(A;CI;KA;;;BA)(A;CI;KA;;;SY)(A;CI;KA;;;CO)(A;CI;KR;;;AC)

And Default contains this string:

O:BAG:SYD:P(A;CI;KRKW;;;BU)(A;CI;KA;;;BA)(A;CI;KA;;;SY)(A;CI;KA;;;CO)(A;CI;KR;;;AC)

It would be wise to store the old values somewhere in case you need to undo the change. If necessary, use the Permissions entry on the context menu of the SecurityDescriptors key to take ownership and assign write permissions on the key to Administrators. Restart the computer and the new power security will be in effect.