I'm trying really hard to find a simple way to fetch all network UUIDS on my Mac to be able to do some plist magic.
Is there a command to do such a thing?
If I look in the plist I'll find for an instance "Service Order"
ServiceOrder = Array {
2AF2313D-AB7E-4FE7-91C3-XXXXXXXXXXXX
9B976E4D-F7BE-428D-88C2-YYYYYYYYYYYY
9A26C39B-8BD4-4562-9E0A-ZZZZZZZZZZZZ
But is there a simpler way than just writing a long script deleting the parts before and after?
All computers running Yosemite.
Final Script - Thanks to @Asmus for providing answers to get this working
#!/bin/sh
# Setting value on "SetUDIDSets" to define the "Sets" name as this will be different on each computer
SetUDIDSets=$(/usr/libexec/PlistBuddy -c "print :Sets" /Library/Preferences/SystemConfiguration/preferences.plist | perl -lne 'print $1 if /^ (\S*) =/')
IFS=$'\n'
# Loops through the list of network services and sets Exclude Simple Hostnames to 1.
for i in $(/usr/libexec/PlistBuddy -c "print :Sets:$SetUDIDSets:Network:Global:IPv4:ServiceOrder" /Library/Preferences/SystemConfiguration/preferences.plist | awk 'NR>2{ print l} {l=$0}' | perl -pe 's/^\s+//');
do
# If the setting Exclude Simple Hostnames never has been touched we need to create this
sudo /usr/libexec/PlistBuddy -c "add :NetworkServices:$i:Proxies:ExcludeSimpleHostnames integer 1" /Library/Preferences/SystemConfiguration/preferences.plist
sudo /usr/libexec/PlistBuddy -c "set :NetworkServices:$i:Proxies:ExcludeSimpleHostnames 1" /Library/Preferences/SystemConfiguration/preferences.plist
echo "Exclude Simple Hostnames is now set for $i"
done
unset IFS
defaults read /Library/Preferences/SystemConfiguration/preferences.plist
echo "We're done!"
networksetup -listnetworkserviceorder
help? It doesn't return the UUIDs, but prints the information nicely andnetworksetup
is the tool to enable/disable network configurations.