Skip to main content

Our library lab likes to use the desktop picture as a means to advertise upcoming events. The Windows computers are set to look to a network share, to which the library staff have write access. That way, the staff just drops the image in the folder, and it changes the desktop. On the Mac side, I've been using a Casper policy to push out the image and the com.apple.desktop.plist file, but I'd like something more akin to what the Windows side does. The Macs are bound to AD, and I have been pushing the .plis to /System/Library/User Template/English.lproj.



Any thoughts would be much appreciated.



-tep

You could always use a cp command to copy it to the local HDD from the SMB share and then edit the plist via script. Run it at login. Or just package it and push the package. Thats how I used to do it. Just pushed a package with the script and image inside.



defaults write com.apple.desktop Background '{default = {ImageFilePath = "/Library/Desktop Pictures/whatever.jpg"; };}'

@Matt - Good idea! I'll give that a go.


Or curl...



https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/curl.1.html


I created a script to copy the file down, but now I want to limit it to AD users. I know that you can scope a policy to a group, but would like to include it in my script. Here's what I've got:



#!/bin/bash

############

# Change SOURCE path as needed for individuals machine
SOURCE="/Users/username"
USER=whoami
CADIR=dscl /Active Directory/PRODUCTION/All Domains -read /Users/$USER RealName | sed s'/RealName://'g | cut -c 2-50 | sed s'/ /./'g | tr '
' ' ' | sed s'/ //'g


# Make sure someone is logged in first!
who | grep console
if [ `echo $?` == 1 ]; then
exit 0
else
echo "continue"
fi

# Check to see if Server is currently mounted - if not, mount it
df | grep /Volumes/Wallpaper
if [ `echo $?` == 0 ]
then
echo $CADIR
else
mkdir /Volumes/Wallpaper
/sbin/mount -t smbfs cifs://files.macalester.edu/admin/groups/LIBSTAFF/Desktop_Backgrounds /Volumes/Wallpaper
fi


# Copy desktop background from server to local machine and set default wallpaper

cp /Volumes/Wallpaper/background_m.jpg /Users/Shared/background.jpg
cp /Volumes/Wallpaper/com.apple.desktop.plist /System/Library/User Template/English.lproj/Library/Preferences/com.apple.desktop.plist

chmod -R 777 /Users/Shared/background.jpg

#exit