Skip to main content
Question

Smart group if computername is serialnumber as variables


beeboo
Forum|alt.badge.img+7

Aside from making an EA then making smart groups based on that value, is it possible with the native GUI to do the following:

  1. create new smart group
  2. select "computer name" is/is not/like/etc
  3. select "serial" or add in $Serial_Number or something like that

that way I can compare the values that JSS already has - serial in hardware, computer name in general.

Otherwise the crappy way would be run the policy to rename computer name once a week or something but have no group reporting :(
Thanks!

2 replies

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3536 replies
  • April 24, 2021

@beeboo There's no way to create a Smart Group like you ask without involving an EA. Depending on your naming policy, and whether or not you use AD binding, the easiest thing to do would probably be have a script that runs daily/weekly that checks to see if the current computer name meets your org's standards and rename if not.


Gonzalo
Forum|alt.badge.img+6
  • Contributor
  • 17 replies
  • April 24, 2021

You can use this EA (thanks @mm2270

#!/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>"

Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings