Python Script: pmset--Set Energy Saver Settings For Multiple Computers At Once

If you have 1,000 computers and don’t want them all to power on at the same time, but rather come on at different times, you can use a simple Python script to do so.  I use this in an educational setting where each lab needs a different power setting so that they don’t all power on at once and crash the server when they all try to contact it at once.  It is also a little easier on the power grid.

This works well because my computers have a consistent naming convention of Building-Role-Room-ComputerNumber.  So if my building was A, role was student, room was W105, and computer was 03, the computer name would be A-Student-W105-03.  Now, I can split the computer name at the dash symbol and use the different components as my criteria.

So in the script, I just split the computer name and call upon certain elements to determine what power settings to apply.  Now I can send a single script to every computer and they will all get the appropriate settings.