Skip to main content
Question

How to Create Extension Attribute to Output Latest macOS That Can Be Installed on That System?


Forum|alt.badge.img+3

How to Create an Extension Attribute to output the latest macOS that can be installed on that system?
I created a script that will run through all model identifiers in the script list but it's having a lot of issues, is there an easier way to do this in JAMF?

I've been trying this with dubugs but stil can't figure it out.
My model identifier: Mac14,9
But when I run the script I get:

Model Identifier: Mac14,9

Checking Model: 5

Checking Model: 9

Array Entry for Model Identifier:

System Not Found

 

 

 

#!/bin/bash # Read the Mac's model identifier system_profile=$(system_profiler SPHardwareDataType) model_identifier=$(echo "$system_profile" | awk -F': ' '/Model Identifier/ {print $2}' | tr -d ' ') # Define the list of model identifiers and associated operating systems model_os_list=( ["Mac14,5"]="macOS Ventura" ["Mac14,9"]="macOS Ventura" # Add other model identifiers and operating systems here ) # Debug: Display the value of the model identifier echo "Model Identifier: $model_identifier" # Check if the model identifier exists in the list os="" for model in "${!model_os_list[@]}"; do # Debug: Display the current model in the loop echo "Checking Model: $model" if [[ "${model_identifier//,/}" == "${model//,/}" ]]; then os="${model_os_list[$model]}" break fi done # Debug: Display the value of the array entry for the model identifier echo "Array Entry for Model Identifier: $os" # Check if the operating system is found if [[ -n "$os" ]]; then echo "Operating System: $os" else echo "System Not Found" fi

 

 

 




3 replies

jamf-42
Forum|alt.badge.img+17
  • Esteemed Contributor
  • 744 replies
  • May 26, 2023

redacted 


Forum|alt.badge.img+14

Have you tried using this Extension Attribute from Zack Thompson?  It's what I use in many of my environments and works like a charm!


AJPinto
Forum|alt.badge.img+26
  • Legendary Contributor
  • 2716 replies
  • June 7, 2023

I would suggest using regex and a smart group for this. Not exactly what you may be after, but it would gather the data from JAMF rather than the device and you can configure the regex for any OS version you want.


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