Posted on 07-22-2014 03:03 PM
We're a pretty large organization, and when a user calls our help desk one of the first things they ask for is the IP address of the machine they're on. A lot of our Mac users don't know how to get that information, even though it can be explained to them a better way would be to have a big button in Self Service that says "What is my IP Address" or something.
Casper already knows each user's IP address. Is there a way to leverage that information into a script that displays it for the end user when they click the button in self service? I already have a script that uses jamfhelper to put up a hud window type, I can modify it to display the user's IP address, I assume, if I can find a way to get the IP address in the first place. And possibly to copy it to the user's clipboard when they click an OK button in the window that pops up.
And before you ask, no, the help desk does not have access to casper and that will probably change in the future, but for right now I need a way to utilize Self Service to display an end user's IP address for them. Any ideas?
Solved! Go to Solution.
Posted on 07-23-2014 10:59 AM
Couldn't resist. did this today.
this will give you consecutive popups for any active IP addresses.
I use detecting a subnet to tell me if that interface has an IP.
#! /bin/bash
# Name: MyIP.sh
# Version: 1.0
# Author: Peter Gawlocki
SUBonTB=`networksetup -getinfo Thunderbolt Ethernet|grep Subnet| wc |awk '{print $1}'`
SUBonWiFi=`networksetup -getinfo Wi-Fi|grep Subnet| wc |awk '{print $1}'`
SUBonEnet=`networksetup -getinfo Ethernet|grep Subnet| wc |awk '{print $1}'`
if [ $SUBonEnet = 1 ]
then
ReportEnetAddress=`networksetup getinfo Ethernet|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Ethernet is: "$ReportEnetAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
if [ $SUBonWiFi = 1 ]; then
ReportWiFiAddress=`networksetup getinfo Wi-Fi|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Wireless is: "$ReportWiFiAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
if [ $SUBonTB = 1 ]; then
ReportTBENAddress=`networksetup getinfo Thunderbolt Ethernet|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Ethernet is: "$ReportTBENAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
Posted on 07-23-2014 03:44 PM
@PeterG thanks for posting this. I added in the Display Ethernet my designers use.
#! /bin/bash
# Name: MyIP.sh
# Version: 1.0
# Author: Peter Gawlocki
SUBonTB=`networksetup -getinfo Thunderbolt Ethernet|grep Subnet| wc |awk '{print $1}'`
SUBonDTB=`networksetup -getinfo Display Ethernet|grep Subnet| wc |awk '{print $1}'`
SUBonWiFi=`networksetup -getinfo Wi-Fi|grep Subnet| wc |awk '{print $1}'`
SUBonEnet=`networksetup -getinfo Ethernet|grep Subnet| wc |awk '{print $1}'`
if [ $SUBonEnet = 1 ]
then
ReportEnetAddress=`networksetup getinfo Ethernet|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Ethernet is: "$ReportEnetAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
if [ $SUBonWiFi = 1 ]; then
ReportWiFiAddress=`networksetup getinfo Wi-Fi|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Wireless is: "$ReportWiFiAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
if [ $SUBonTB = 1 ]; then
ReportTBENAddress=`networksetup getinfo Thunderbolt Ethernet|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Ethernet is: "$ReportTBENAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
if [ $SUBonDTB = 1 ]; then
ReportTBENAddress=`networksetup getinfo Display Ethernet|grep IP| awk '{print $3}'`
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -icon /System/Library/PreferencePanes/Network.prefPane/Contents/Resources/Network.icns -title "Your IP Address" -description "Your current IP address for Display Ethernet is: "$ReportTBENAddress -button1 "Ok" -cancelButton 1 -timeout 10;
fi
Posted on 12-29-2015 11:40 AM
Here is the error that would take place when running a script from Self Service. The script was called "Show IP" and did not include an exit command.
I suspect it might be related to how Casper Suite 9.82 handles error codes or when there is no exit.
I added an exit 0 to the end of the script to fix the issue.
exit 0
Posted on 10-18-2016 09:24 AM
Wondering if anyone ever discovered a way to do this with OS versions after Yosemite and via Self Service versions after v9.82. Specifically we are now on Self Service v9.96 and have El Capitan 10.11.6 and Sierra 10.12.0 in production. The script variations above that were successful always generated the error shown immediately above in OS versions post-Yosemite. Third party solutions to present this information are not an option in our environment. The "Show additional information in the menu bar" setting for Login Window through Configuration Profiles goes a long way toward resolving this, however requires the active user to log out.
Ideally, we would also have a Self Service based means of displaying the node name and IP Address(es) to the end-user while allowing them to remain logged in. Most users are not particularly savvy at locating this quickly and they are routinely asked for the info by a rotating staff of Service Desk technicians that may or may not know how to provide instructions for its retrieval from the login window menubar. Thoughts?
Posted on 07-05-2017 05:17 AM
Ive updated one of the scripts above so it works with MacOS Sierra. And also made it look a little more professional with a little icon next to the information.
#!/bin/bash
# dispaly information to end user
# set IFS for new line
# use unset IFS to reset it to default value
IFS=$'
'
## Setting up services to display
## Get the Mac's name
MACNAME=$(scutil --get ComputerName)
#Get list of networkservices exlcuding disabled services
NetServices=$(networksetup -listallnetworkservices | grep -v '*')
for service in ${NetServices} ; do
echo "${service}: $(networksetup -getinfo ${service} | awk '/IP address:/ { gsub("[a-z]", ""); print $3 }' | sed 's/://g')" >> /tmp/netinfo.txt
done
#Applescript to display dialog
osascript <<AppleScript
tell application "Finder"
activate
set ComputerNameInfo to "Machine Name: $MACNAME" & "
$(cat /tmp/netinfo.txt)"
display alert "Your computer informaton is:" message ComputerNameInfo
end tell
AppleScript
unset IFS
#Clean up temp file created
rm -rf /tmp/netinfo.txt
exit 0
Posted on 07-25-2017 03:27 AM
Have to say, lust like others i am starting to go a bit stirr crazy with our service desk and users not log proper information cause they just freeze when the user says its a mac.
so dont want to clutter up menu bar as we have already done that with all our drivers and utilities, and logon window only being asscesable when logged off. what apps could 'Write' on the desktop
apart from the BGINFORX whcih im not very imprested with and Geektool which is almost overkill what else can do it?