Restrictions based on Battery or AC Power

richeames
New Contributor III

Has anyone created a rule based on a portable computer being plugged in or using battery. I'm trying to see if I could restrict software from running only if the device is on battery power.

I'd be interested in stopping students from playing games while in school since their device is on battery but once they are home and plugged in it would allow the game to be played. It might solve a couple things, one of them conserving battery life.

Thanks,
Rich

2 REPLIES 2

paperhatGroup
New Contributor

The terminal command

pmset -g ac

Will tell you whether a charger is attached or not.

If one is attached, you will get details of the charger

Wattage = 60W Revision = 0x0000 AdapterID = 256 Family Code = 0x00ba Serial Number = <redacted>

If it's not, it will return

No adapter attached.

You should be able to cook up a script and rule to run the check with that information

Not applicable

I also have the same question, waiting for suggestions