Hi,
I'm looking for an extension attribute that displays if the computer name is set to $serialnumber of the computer. The purpose is to run a rename policy to machines that has not $serialnumber as computer name.
Extension attribute for computer name
Best answer by mm2270
Something like this as an EA would help you build a Smart Group
#!/bin/sh
computer_name=$(scutil --get ComputerName)
serial_number=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformSerialNumber/{print $4}')
if [ "$computer_name" == "$serial_number" ]; then
result="Yes"
else
result="No"
fi
echo "<result>$result</result>"
FWIW, I have a similar issue here where a machine certificate takes on the machine name as part of the CN when it gets pushed to the device, and I had to work around issues where the profile would come down too early in our provisioning process and name the cert incorrectly, meaning before my provisioning workflow had a chance to correctly name the device. I have a script that renames the computer to our naming convention as early on as possible, and then collects inventory, so the Mac lands in a Smart Group scoped to the profile that deploys the machine certificate. I have this Smart Group set up looking for computers that have the proper naming convention, but I'm not using an EA for that. We have a prefix for our names that I can pick up in the Smart Group using a regex pattern match instead.
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.