Posted on 08-28-2020 09:47 AM
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"
Solved! Go to Solution.
Posted on 08-28-2020 11:28 AM
@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"
Posted on 08-28-2020 01:28 PM
@Macuser1810 You have to quote $pathToFile in the call to jamfHelper (i.e. ... -icon "$pathToFile"...
)
Posted on 08-28-2020 11:28 AM
@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"
Posted on 08-28-2020 01:03 PM
@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
Posted on 08-28-2020 01:10 PM
@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.
Posted on 08-28-2020 01:24 PM
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
Posted on 08-28-2020 01:24 PM
@Macuser1810 As @sdagley said - I've used the path without the quotes but with escaped characters and it worked.
Posted on 08-28-2020 01:25 PM
@Kornel Trying that on the script now
Posted on 08-28-2020 01:28 PM
@Macuser1810 You have to quote $pathToFile in the call to jamfHelper (i.e. ... -icon "$pathToFile"...
)
Posted on 08-28-2020 01:41 PM
Posted on 08-29-2020 09:56 PM
@Macuser1810 Glad to hear it. BTW, if you haven't seen it yet, jHelper-GUI is a useful tool for creating a jamfHelper command.