Hi all
I'm trying to create a policy in self service which displays a dialogue box with the computer's current IP address or addresses.
Having done a bit of reading around, the way JAMF runs AppleScript as the root user can cause issues getting the results to the currently logged-in user.
My script below runs the script in bash as the currently logged in user, and I have tested it to work fine in Mac OSX as a script.sh file, but when I try to run it in JAMF I get nothing, the JAMF log simply says:
Executing Policy Network Status
Wed Sep 27 11:58:29 MacBook Pro jamf[18349]: Checking for policy ID 852...
#!/bin/sh
currentUser=$( ls -l /dev/console | cut -d " " -f4 )
sudo -u $currentUser osascript <<EOD
tell application "System Events"
delay 0
set myIPAddress to (do shell script "ifconfig | grep 'inet ' | grep -v 'inet 127' | cut -c1-21")
display dialog "IP Address Details: " & myIPAddress
end tell
EOD
Am I missing something obvious here? Any help would be greatly appreciated.
Thanks,
Sebastian.