I am looking to report the status of Location Services on our fleet. I found the following script online and tested it but it only reports back disabled even when LS is enabled. Does anyone have a working extension for this? Or can some assist in making this one work?
#!/bin/bash
uuid=$(system_profiler SPHardwareDataType | grep "Hardware UUID" | awk '{print $3}')
domain="/var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.${uuid}"
plist="${domain}.plist"
if [[ -f "${plist}" ]]
then
status=$(defaults read "${domain}" LocationServicesEnabled)
if [[ "${status}" == "1" ]]
then
result="Enabled"
else
result="Disabled"
fi
else
result="Unavailable"
fi
echo "<result>${result}</result>"
