I'm setting up a Self Service script to pop up a window displaying the hostname and IP addresses. Here's what I have:
#!/bin/bash
compname=`scutil --get ComputerName`
wifi_IP=`networksetup -getinfo Wi-Fi | grep "IP address" | head -n 1`
ethernet_IP=`networksetup -getinfo Ethernet | grep "IP address" | head -n 1`
thunderbolt_IP=`networksetup -getinfo Thunderbolt Ethernet | grep "IP address" | head -n 1`
display_IP=`networksetup -getinfo Display Ethernet | grep "IP address" | head -n 1`
if [[ `networksetup -listallnetworkservices | grep Wi-Fi` == "Wi-Fi" ]]; then
wifimsg="Wireless $wifi_IP"
else
wifimsg="--------"
fi
if [[ `networksetup -listallnetworkservices | grep -o Ethernet | head -n 1` == "Ethernet" ]]; then
ethernetmsg="Ethernet $ethernet_IP"
else
ethernetmsg="--------"
fi
if [[ `networksetup -listallnetworkservices | grep Thunderbolt Ethernet` == "Thunderbolt Ethernet" ]]; then
thunderboltmsg="Thunderbolt Ethernet $thunderbolt_IP"
else
thunderboltmsg="--------"
fi
if [[ `networksetup -listallnetworkservices | grep Display Ethernet` == "Display Ethernet" ]]; then
displaymsg="Display Ethernet $display_IP"
else
displaymsg="--------"
fi
Desc="Mac Hostname: $compname
$wifimsg
$ethernetmsg
$thunderboltmsg
$displaymsg"
MSG=$( echo "$Desc" )
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -heading "Computer Information" -description "$MSG" -button1 "OK"
exit 0
For some reason, I only see the first 2 -------- lines. displayMessage shows the full text, but I like the look of jamfHelper better.
Is there a limit to how big the jamfHelper dialog can be? I may resort to doing a displayMessage, or even an osascript display dialog.