macOS Version display Script

bmee
Contributor

I was just wondering if there is a way to print the output of the sw_vers commend into a popup windows when it's run in Self Services?

2 ACCEPTED SOLUTIONS

mm2270
Legendary Contributor III

To go several steps further, you could look at implementing the script detailed on this thread.

View solution in original post

cubandave
Contributor

@meexiong Something like this?
245b5a0faa324a7dbc3905eebf62b96b
You can pretty much display anything with jamfHelper. To see all your option check out the help page. /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -help

#protip...Making the description a variable also allows you to print it out in multiple lines.

script example

#!/bin/bash

#variables to change jamfHelper
jamfHelper_title="Your IT Department"
jamfHelper_desc="About your macOS Version"
system_info_icon="/Applications/Utilities/System Information.app/Contents/Resources/ASP.icns"

jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"

sw_vers_full=`sw_vers`

# separate the elements into indvidual variables
sw_vers_ProductName=`echo "$sw_vers_full" | grep ProductName | awk -F ": " '{ print $2 }'`
sw_vers_ProductVersion=`echo "$sw_vers_full" | grep ProductVersion | awk -F ":   " '{ print $2 }'`
sw_vers_BuildVersion=`echo "$sw_vers_full" | grep BuildVersion | awk -F ":   " '{ print $2 }'`

# output to script retults to policy log
echo ProductName is "$sw_vers_ProductName"
echo ProductVersion is "$sw_vers_ProductVersion"
echo BuildVersion "$sw_vers_BuildVersion"

#create the message for jamfHelper
about_your_mac_details="ProductName:   $sw_vers_ProductName
ProductVersion: $sw_vers_ProductVersion
BuildVersion:   $sw_vers_BuildVersion"

#display jamfHelper window with & to have it exit quickly
"$jamfHelper" -windowType hud -icon "$system_info_icon" -heading "$jamfHelper_desc" -title "$jamfHelper_title" -description "$about_your_mac_details" -button1 "OK" &

View solution in original post

6 REPLIES 6

mm2270
Legendary Contributor III

To go several steps further, you could look at implementing the script detailed on this thread.

mack525
Contributor II

@meexiong Running sw_vers | grep ProductVersion | cut -d':' -f2 can get you what you need.. what are you looking to do?

bmee
Contributor

Hello I'm actually looking for something like what @mm2270 post.

Thanks,

mack525
Contributor II

@meexiong I was going to recommend something like that. It's in our environment.

cubandave
Contributor

@meexiong Something like this?
245b5a0faa324a7dbc3905eebf62b96b
You can pretty much display anything with jamfHelper. To see all your option check out the help page. /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -help

#protip...Making the description a variable also allows you to print it out in multiple lines.

script example

#!/bin/bash

#variables to change jamfHelper
jamfHelper_title="Your IT Department"
jamfHelper_desc="About your macOS Version"
system_info_icon="/Applications/Utilities/System Information.app/Contents/Resources/ASP.icns"

jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"

sw_vers_full=`sw_vers`

# separate the elements into indvidual variables
sw_vers_ProductName=`echo "$sw_vers_full" | grep ProductName | awk -F ": " '{ print $2 }'`
sw_vers_ProductVersion=`echo "$sw_vers_full" | grep ProductVersion | awk -F ":   " '{ print $2 }'`
sw_vers_BuildVersion=`echo "$sw_vers_full" | grep BuildVersion | awk -F ":   " '{ print $2 }'`

# output to script retults to policy log
echo ProductName is "$sw_vers_ProductName"
echo ProductVersion is "$sw_vers_ProductVersion"
echo BuildVersion "$sw_vers_BuildVersion"

#create the message for jamfHelper
about_your_mac_details="ProductName:   $sw_vers_ProductName
ProductVersion: $sw_vers_ProductVersion
BuildVersion:   $sw_vers_BuildVersion"

#display jamfHelper window with & to have it exit quickly
"$jamfHelper" -windowType hud -icon "$system_info_icon" -heading "$jamfHelper_desc" -title "$jamfHelper_title" -description "$about_your_mac_details" -button1 "OK" &

bmee
Contributor

@cubandave That is very cool. I'll give that a shot as well. Thank You everyone for helping me or point me to the right direction.