Energy Saver - Hard Disk Sleep

New Contributor III

I would like to apply a policy to all my machines in order to deselect " Put Hard Disks to sleep when Possible" for some reason the policy failed in the middle of deployment:

Executing Policy HD No Sleep...
Running script HD No Sleep...
Script exit code: 0
Script result: Fail (10)

This is my script that i used from "Extension Attribute"



Valued Contributor III

As I understand it disksleep is not a binary value, it's the number of minutes before the event.
Anything other than 0 or no value is true.

Legendary Contributor III

You need to actually edit the first line that states it needs to be edited to a value you want it to check on.

For example, if you want all your Macs to have disksleep to be enabled and set to a value of 10, then edit the line that says:




When the EA script runs, if the Mac's hard disk sleep setting is set to 10 (minutes), the result will show up as:

Pass (10)

EDIT: Also, I hope you weren't using the above script as a way to actually set the disksleep value. That script is just an Extension Attribute script, so it pulls in a value during inventory collection. Its not going to set anything on the Mac. There is the concept of an "Active EA" where you can make the script take an action if something isn't set correctly. I would personally keep the 2 items separate myself, but you could modify it to change the pmset disksleep value if you wanted to.