Support Center

(Mac) Setting Desktop Wallpaper Using JumpCloud Commands

The osascript command can be used to execute AppleScript statements on target Mac systems using JumpCloud commands. 

AppleScript is a scripting language created by Apple that facilitates automated control over Mac applications and Mac OS.

By default, the following example uses the osascript command to execute an AppleScript statement which sets the desktop wallpaper to "JumpCloud_Background.png".

The "JumpCloud_Background.png" file is downloaded to the local machine and saved in the folder "/Users/Shared"/

To modify this command to download and set a background image of your choice follow the steps under '*** Customize ***' by updating the backgroundURL and corresponding fileType variables.

This command used in tandem with the wallpaper modification Mac policy can be used to set and then prevent end users from updating their background.
 
# *** Customize ***  

# 1. Update the 'backgroundURL' to the URL of your desired desktop image. A JumpCloud image is used by default.

backgroundURL="https://raw.githubusercontent.com/TheJumpCloud/support/master/PowerShell/JumpCloud%20Commands%20Gallery/Files/JumpCloud_Background.png"

# 2. Ensure the 'fileType' matches the file type of the desktop image (change to jpg if using a jpg). 'png' is set by default.

fileType="png"

# ------------Do not modify below this line------------- 

user=`ls -la /dev/console | cut -d " " -f 4`

date_val=$(date "+%Y-%m-%d-%H%M")

curl -s -o /Users/Shared/desktopimage_$date_val.$fileType $backgroundURL

sudo -u $user osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Users/Shared/desktopimage_'"$date_val"'.'"$fileType"'"'
The above command can be built manually as a Mac command where the 'run-as' user is set to the root user or it can be imported using the JumpCloud PowerShell module by following this link
 

Last Updated: Jul 11, 2018 12:36PM MDT

Related Articles
desk-forwarding@jumpcloud.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete