Skip to content

Instantly share code, notes, and snippets.

@talkingmoose
Created March 13, 2018 19:04
Show Gist options
  • Save talkingmoose/abd85bdedce0624dbf13c472a7a9681c to your computer and use it in GitHub Desktop.
Save talkingmoose/abd85bdedce0624dbf13c472a7a9681c to your computer and use it in GitHub Desktop.
Jamf Extension Attribute reports whether computer name matches serial number.
#!/bin/sh
computerName=$( scutil --get ComputerName )
serialNumber=$( system_profiler SPHardwareDataType | grep 'Serial Number' | awk -F: '{ print $2 }' | xargs )
if [ "$computerName" = "$serialNumber" ]; then
echo "<result>Computer Name is correct</result>"
else
echo "<result>Computer Name is incorrect</result>"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment