Monday
I was wondering if we can build a smart group for devices based on the devices country?
at the moment, we have our devices scattered around the globe (USA[Chicago/NewYork/SanFrancisco/Florida/Houston], United Kingdom, South Africa, Japan, New Zealand, Australia [Sydney/Melbourne/Brisbane/Perth]
Solved! Go to Solution.
Tuesday
JAMF has a built-in Extension Attribute for IP-GEO Location. I had to fix a few fields, but it will report City, State and Two Character Country Code.
#!/bin/sh
myIP=`/usr/bin/curl http://ifconfig.me/ip`
myLocationInfo=`/usr/bin/curl http://ip-api.com/xml/$myIP`
mycountryCode=`echo $myLocationInfo|egrep -o '<countryCode>.*</countryCode>'| sed -e 's/^.*<countryCode/<countryCode/' | cut -f2 -d'>'| cut -f1 -d'<'`
mycity=`echo $myLocationInfo|egrep -o '<city>.*</city>'| sed -e 's/^.*<city/<city/' | cut -f2 -d'>'| cut -f1 -d'<'`
myregionName=`echo $myLocationInfo|egrep -o '<regionName>.*</regionName>'| sed -e 's/^.*<regionName/<regionName/' | cut -f2 -d'>'| cut -f1 -d'<'`
echo "<result>$mycity, $myregionName - $mycountryCode</result>"
Monday
You can build a smart group for devices based on their country in Jamf Pro. You can use the device inventory information, specifically the "Location" field, to create a smart group based on the devices' country.
Here are the steps to create a smart group based on the devices' country in Jamf Pro:
You can repeat these steps to create smart groups for each country where your devices are located. Once you have created the smart groups, you can use them to manage and deploy policies and configurations to devices based on their location.
Tuesday
JAMF has a built-in Extension Attribute for IP-GEO Location. I had to fix a few fields, but it will report City, State and Two Character Country Code.
#!/bin/sh
myIP=`/usr/bin/curl http://ifconfig.me/ip`
myLocationInfo=`/usr/bin/curl http://ip-api.com/xml/$myIP`
mycountryCode=`echo $myLocationInfo|egrep -o '<countryCode>.*</countryCode>'| sed -e 's/^.*<countryCode/<countryCode/' | cut -f2 -d'>'| cut -f1 -d'<'`
mycity=`echo $myLocationInfo|egrep -o '<city>.*</city>'| sed -e 's/^.*<city/<city/' | cut -f2 -d'>'| cut -f1 -d'<'`
myregionName=`echo $myLocationInfo|egrep -o '<regionName>.*</regionName>'| sed -e 's/^.*<regionName/<regionName/' | cut -f2 -d'>'| cut -f1 -d'<'`
echo "<result>$mycity, $myregionName - $mycountryCode</result>"
Tuesday
Thank you.
i put this script as my extension attribute and used it to create smartgroup.