Created
August 30, 2021 19:49
-
-
Save stevewood-tx/8ade3c4133fe0fcdc853bc7be10f9436 to your computer and use it in GitHub Desktop.
Upload Log to Jamf
This file contains 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
## upload log to JPS | |
xpath() { | |
# the xpath tool changes in Big Sur | |
if [[ $(sw_vers -buildVersion) > "20A" ]]; then | |
/usr/bin/xpath -e "$@" | |
else | |
/usr/bin/xpath "$@" | |
fi | |
} | |
apiUser='' | |
apiPass='' | |
jpsURL="" | |
serial=$(system_profiler SPHardwareDataType | awk '/Serial\ Number\ \(system\)/ {print $NF}'); | |
## get ID of computer | |
JSS_ID=$(curl -H "Accept: text/xml" -sfku "${apiUser}:${apiPass}" "${jpsURL}/JSSResource/computers/serialnumber/${serial}/subset/general" | xpath /computer/general/id | awk -F'>|<' '{print $3}') | |
curl -sku $apiUser:$apiPass $jpsURL/JSSResource/fileuploads/computers/id/$JSS_ID -F name=@${logFile} -X POST | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment