How to run a specific policy based on OS version installed?

RLim945
New Contributor III

I'm trying to create a policy which runs a script. I want the script to check the OS version installed and depending on if it's running a version that is High Sierra or lower than High Sierra, I want it to install a pkg. I'm limited in my scripting skills, so hopefully I can get some guidance.

Here's what I have so far:

I can get the version installed by running:

defaults read loginwindow SystemVersionStampAsString

Then, I have the 2 pkg's with a custom trigger. I just need to figure out how to run a specific pkg depending on what OS the computer is running. I suppose I can restrict it by excluding certain OS's on the 2 policies, but thought it might be cleaner/simpler to put it into a script. Perhaps I'm overthinking this?

Thanks for any help!

1 REPLY 1

claudiogardini
Contributor

You could script all of this. However the easiest and probably cleanest way ist just to create different Smart Groups for "10.13 and higher" and "lower than 10.13" and then scope the corresponding policies to that Smart Group.