Skip to main content
Jamf Nation, hosted by Jamf, is a knowledgeable community of Apple-focused admins and Jamf users. If you like what you see, join us in person at the ninth annual Jamf Nation User Conference (JNUC) this October for three days of learning, laughter and IT love.
Posted: by clrlmiller
Product: Casper Suite
Downloads: 152
Download

Description

This is a sometimes handy Extension Attribute to avoid customers on laptops attempting to pull down sizable installations (Adobe CC, MATLab, OS X Upgrades, etc.) while running on the laptop battery. Use this to avoid installs interrupted by system sleep or a battery nearing exhaustion. This works for Desktops as well. They'll just always report "Now drawing from AC Power...". An example would be using as a policy exclusion for when a system was last reported as "Now drawing from Battery Power...". Insist the user Plug in the cord and update their inventory before being allowed to run the lengthy install. ########################################################### #!/bin/bash ########################################### # Check to see where power is being drawn # 'Battery Power' vs. 'AC Power' ########################################### # by Christopher Miller # for ITSD-ISS of JHU-APL # Dated: 2016-05-24, last Mod: 2016-05-24 # Cobbled together from other's hard work ########################################### #Use the power management to check PowerUP=$(pmset -g batt | head -n 1) #Find the time this was checked ShotTime=$(/bin/date) #Put it together result=$(echo "$PowerUP" on "$ShotTime") echo "<result>$result</result>" exit 0

Preview

Generating Preview...