AutomoxAutomox

Set Wallpaper on MacOS

VicKhan
September 14, 2020 at 8:29 pm UTC

This script will set the wallpaper for Mac devices to one of your choosing. Just upload the wallpaper and adjust naming as needed. Please note, if a user has not previously allowed Finder in AppleEvents, they may get a prompt to allow. (If they accidently hit no to allow, AppleEvents can be reset using the command “tccutil reset AppleEvents”)

bash8 lines
#!/bin/bash

#copy the .png file to the device
scp DesktopWallpaper.png /library/

#Set wallpaper for user
currentUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{print $3}')
sudo -u "$currentUser" -H osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/library/DesktopWallpaper.png"'

This discussion is archived and closed to replies. Continue it in the Automox Community Slack.

Discuss on Slack