Hello,
So I am trying to get the wallpaper login policy to set the wallpaper, it works on one of my test machines Mac Book Air that running a M1 chip but the iMac that I have thats running a intel i5 chip is not handling the osascript. It errors with this: 33:48: execution error: Finder got an error: AppleEvent handler failed. (-10000)
#!/bin/bash
#Create Directory for Custom Image
mkdir '/Library/Wallpaper'
# Change directories
cd '/Library/Wallpaper/'
# Download the wallpapercurl -k -Os https://linktowallpaper.com -s
cd '../..'
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 "/Library/Wallpaper/Background.jpg"'