Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Compares known and current network services and creates an unknown network services list.
#!/bin/zsh
# list of known network services that should be excluded from results
defaultNetworkServices="An asterisk (*) denotes that a network service is disabled.
USB-C Dock Ethernet
Apple USB Ethernet Adapter
Wi-Fi
iPhone USB
Bluetooth PAN
Thunderbolt Bridge"
# create list of current network services
currentNetworkServices=$( /usr/sbin/networksetup -listallnetworkservices )
# create list of unknown network services
while IFS= read aService
do
if [[ "$defaultNetworkServices" != *"$aService"* ]]; then
serviceList="$aService
$serviceList"
fi
done <<< "$currentNetworkServices"
# return list to Jamf Pro
echo "<result>${serviceList%?}</result>"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.