Posted on 06-05-2014 01:20 PM
We are getting a little bit tired of having to ask our users to give us their IP and/or computer name and where to find it. It would be really awesome to create script that would show a popup on their screens that displays this for them. Anyone have any ideas? We have worked on something but for some reason, it isn't working through SS.
Posted on 06-05-2014 01:34 PM
That should be pretty easy. Do you deploy something like cocoaDialog to your Macs? If not, jamfHelper would suffice as well. Heck, even Applescript could do it, but you sometimes run into a challenge with getting the message to display to the current user.
Here's a quick idea using cocoaDialog. Change the path to it as needed. You could also just flip it all to use some other method like jamfHelper.
#!/bin/sh
cdPath="/Library/Application Support/JAMF/bin/cocoaDialog.app/Contents/MacOS/cocoaDialog"
ActivePort=$( /usr/sbin/netstat -rn 2>&1 | /usr/bin/grep -m 1 'default' | awk '{print $NF}' )
IPAddress=$( ipconfig getifaddr "$ActivePort" )
CompName=$( scutil --get ComputerName )
Msg="Mac Name: $CompName
IP Address: $IPAddress"
"$cdPath" msgbox --title "Computer Information"
--text "Your Mac's details are:" --informative-text "$Msg"
--icon info --button1 " OK "
You could expand it to throw more information into the dialog if you want.