scriptingosx / desktoppr

Simple command line tool to set the desktop picture on macOS
Apache License 2.0
289 stars 27 forks source link

Setting desktop Picture with Jamf not working #5

Closed GabeShack closed 3 years ago

GabeShack commented 4 years ago

Hey, Im using your recommend example script to set our users desktop to the below 10.15.6 file path. This works from terminal just fine, and when I run the script from jamf it says it completed successfully, however it is not changing anything.

/System/Library/Desktop Pictures/Solar Gradients.heic

Attached is the script:

#!/bin/sh

##
## sets the desktop using `desktoppr`
##

export PATH=/usr/bin:/bin:/usr/sbin:/sbin

# set the path to the desktop image file here
picturepath="/System/Library/Desktop Pictures/Solar Gradients.heic"

# verify the image exists
if [ ! -f "$picturepath" ]; then
    echo "no file at $picturepath, exiting"
    exit 1
fi

# verify that desktoppr is installed
desktoppr="/usr/local/bin/desktoppr"
if [ ! -x "$desktoppr" ]; then
    echo "cannot find desktoppr at $desktoppr, exiting"
    exit 1
fi

# get the current user
loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' )

# test if a user is logged in
if [ -n "$loggedInUser" ]; then
    # set the desktop for the user
    sudo -u "$loggedInUser" "$desktoppr" "$picturepath"
else
    echo "no user logged in, no desktop set"
fi
scriptingosx commented 4 years ago

Too little information to give a proper diagnosis. Is desktoppr installed on the client? Is a user logged in when the script is running? What is the output of the script, other than it ran successfully?

scriptingosx commented 3 years ago

closing for lack of response