Jamf Helper with Custom logo

Macuser1810
New Contributor III

Hello, does anyone know how to include a custom image on a JAMF helper prompt.

Im able to view the custom image we have for self service branding in ~/Library/Application Support/com.jamfsoftware.selfservice.mac/Documents/Images/brandingimage.png

I tested with another user and they also have the image in that directory, but when I push the policy for JAMF Helper, the message displays but with no image

below is the script

#!/bin/sh


/Library/ApplicationSupport/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -icon ~/Library/Application Support/com.jamfsoftware.selfservice.mac/Documents/Images/brandingimage.png -title "Title" -heading "Welcome to JAMF Self Service" -description "You can use the JAMF self service portal to install software, update software or troubleshoot your device" -button1 "OK" -button2 "Cancel"
2 ACCEPTED SOLUTIONS

sdagley
Esteemed Contributor II

@Macuser1810 A few problems in your script:

The icon path you show has a space in it, which requires you either escape the space like

/Library/Application Support/some/more/path/imagefile.png

or quote the path like

"/Library/Application Support/some/more/path/imagefile.png"

When a Policy runs it's running root, so ~ is not the way you access the current user's home directory. You'd need something like this:

currentUser=$(/bin/echo 'show State:/Users/ConsoleUser' | /usr/sbin/scutil | /usr/bin/awk '/Name / { print $3 }')
pathToFile="/Users/$currentUser/Library/Application Support/some/further/path/theimage.png"

View solution in original post

sdagley
Esteemed Contributor II

@Macuser1810 You have to quote $pathToFile in the call to jamfHelper (i.e. ... -icon "$pathToFile"...)

View solution in original post

9 REPLIES 9

sdagley
Esteemed Contributor II

@Macuser1810 A few problems in your script:

The icon path you show has a space in it, which requires you either escape the space like

/Library/Application Support/some/more/path/imagefile.png

or quote the path like

"/Library/Application Support/some/more/path/imagefile.png"

When a Policy runs it's running root, so ~ is not the way you access the current user's home directory. You'd need something like this:

currentUser=$(/bin/echo 'show State:/Users/ConsoleUser' | /usr/sbin/scutil | /usr/bin/awk '/Name / { print $3 }')
pathToFile="/Users/$currentUser/Library/Application Support/some/further/path/theimage.png"

Macuser1810
New Contributor III

@sdagley I was able to fix the script and get it working, for some reason the Image is not showing up. Could this be due to the file being a PNG? There should be an image on the left hand side
dc9a4a5e5cab4807aa864f3dd7398477

sdagley
Esteemed Contributor II

@Macuser1810 A .png should work fine for the -icon parameter, so something else is wrong. Be sure you don't both escape and quote the path, it's one or the other.

Macuser1810
New Contributor III

currentUser=$(/bin/echo 'show State:/Users/ConsoleUser' | /usr/sbin/scutil | /usr/bin/awk '/Name / { print $3 }')

pathToFile="/Users/$currentUser/Library/Application Support/com.jamfsoftware.selfservice.mac/Documents/Images/brandingimage.png". (ALL IN ONE LINE IN SCRIPT)

/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -icon $pathToFile -title " IT Support" -heading "Welcome to JAMF Self Service" (ALL IN ONE LINE IN SCRIPT)

-description "You can use the JAMF self service portal to install software, update software or troubleshoot your device" -button1 "OK" -button2 "Cancel"

UPDATE: Tried with escaped characters and same issue

Kornel
New Contributor II

@Macuser1810 As @sdagley said - I've used the path without the quotes but with escaped characters and it worked.

Macuser1810
New Contributor III

@Kornel Trying that on the script now

sdagley
Esteemed Contributor II

@Macuser1810 You have to quote $pathToFile in the call to jamfHelper (i.e. ... -icon "$pathToFile"...)

Macuser1810
New Contributor III

@sdagley Thank you so much for the help!!! This was my first JAMF Helper Script. You are awesome!! 👏 @Kornel Thanks for the advice on escape characters, appreciate the input

sdagley
Esteemed Contributor II

@Macuser1810 Glad to hear it. BTW, if you haven't seen it yet, jHelper-GUI is a useful tool for creating a jamfHelper command.