Created
August 3, 2020 03:19
-
-
Save talkingmoose/fd9db85f00a53183de62278a784e0fb5 to your computer and use it in GitHub Desktop.
Compares known and current network services and creates an unknown network services list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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