#!/bin/sh
########## variable-ing ##########
kextList=$(/usr/sbin/kextstat -l | /usr/bin/grep -v 'com.apple' | /usr/bin/awk '{print $6}' | /usr/bin/sort)
########## main process ##########
# Report result.
echo "<result>$kextList</result>"
exit 0
Link:
https://github.com/palantir/jamf-pro-scripts/blob/4672e65091a0684ef9