4 Replies Latest reply: May 19, 2010 8:23 AM by Brian Nesse
Greg_P_Mills Level 1 Level 1 (0 points)
Up until now I haven't played around with ARD much in terms of managing client settings, but recently I've been asked to change the energy saver settings on around 50 machines. I've collected the relevant terminal commands, and they all work individually. But I wanted to combine them all into one task. Can anyone tell me how this can be done? The only way I can think of would be to schedule the separate tasks in a queue.

Here's the series of commands I have ended up with:

defaults -currentHost write com.apple.screensaver idleTime 1
defaults write ~/Library/Preferences/ByHost/com.apple.screensaver.$(ifconfig en0 | awk '/ether/{gsub(/:/,"");print $2}') askForPassword -int 1
defaults -currentHost write com.apple.screensaver idleTime 0
# Set amount of idle time in minutes until a computer sleeps. Specify "Never" or "Off" for computers that should never sleep.
systemsetup -setsleep 45
# Set the amount of idle time in minutes until the hard disk sleeps.
systemsetup -setharddisksleep 90
# Set the amount of idle time in minutes until the display sleeps.
systemsetup -setdisplaysleep 15

Thanks
  • Brian Nesse Level 4 Level 4 (2,860 points)
    You can separate commands on the command line with a semi-colon... i.e.

    systemsetup -setsleep 45; systemsetup -setharddisksleep 90; systemsetup -setdisplaysleep 15

    Additionally, a single command such as systemsetup can generally be called with multiple parameters... i.e.

    systemsetup -setsleep 45 -setharddisksleep 90 -setdisplaysleep 15
  • Greg_P_Mills Level 1 Level 1 (0 points)
    Ah right, thanks Brian. You have been most helpful!
  • Greg_P_Mills Level 1 Level 1 (0 points)
    I realise this may seem obvious to the more experienced users here, but simply putting colons in between the commands didn't work. I realised that some of these commands needed to be run as root, and some as the current user, so I had to split them into two tasks. Does anyone know how I can get around this? Sudo can't be used without user interaction, so is there another way of running the commands as root within the script?

    Here's what I have now:

    defaults write ~/Library/Preferences/ByHost/com.apple.screensaver.$(ifconfig en0 | awk '/ether/{gsub(/:/,"");print $2}') askForPassword -int 1; defaults -currentHost write com.apple.screensaver idleTime 0; systemsetup -setsleep 45 -setharddisksleep 45 -setdisplaysleep 15; pmset -a halfdim 1
  • Brian Nesse Level 4 Level 4 (2,860 points)
    In the Send UNIX Command task, select "User" and enter "root".