SPSS Activation Script

alavon
New Contributor

Hey Jamfers,

My organization has multiple versions of SPSS deployed, so when our yearly license gets renewed it can be a chore to get everyone re-activated as there are different codes for different versions. I put together this script and deployed it through Self-Service, so that people who find themselves unlicensed can quickly re-license their copy. The license codes themselves are stored as parameter input so they can be quickly updated from the policy in the JSS. If anyone else has an environment similar to this, they might find it helpful.

#!/bin/sh
spssdir=$(find /Applications -name SPSSStatistics.app)

for spss in $spssdir; do
    spssver=$(plutil -p $spss/Contents/Info.plist | grep CFBundleShortVersionString)
    if [[ $spssver = *"24"* ]]; then
        cd $spss/contents/bin
        ./licenseactivator $4
        if [ $? -eq 0 ]; then
                    osascript -e 'tell app "System Events" to display dialog "SPSS 24 Activated!"'
                else
                    osascript -e 'tell app "System Events" to display dialog "There was a problem activating this copy of SPSS. Please contact the Helpdesk." with text buttons {"OK"}'
        fi
    fi
    if [[ $spssver = *"25"* ]]; then
        cd $spss/contents/bin
        ./licenseactivator $5
        if [ $? -eq 0 ]; then
                    osascript -e 'tell app "System Events" to display dialog "SPSS 25 Activated!"'
                else
                    osascript -e 'tell app "System Events" to display dialog "There was a problem activating this copy of SPSS. Please contact the Helpdesk." with text buttons {"OK"}'
        fi
    fi
    if [[ $spssver != *"24"* && $spssver != *"25"* ]];
        then
        osascript -e 'tell app "System Events" to display dialog "Please contact the Helpdesk for help activating your copy of SPSS" with text buttons {"OK"}'  
    fi
done
4 REPLIES 4

asegura
Contributor

Thanks for the script. Is there any reason why you guys are not using a license server? We are upgrading our license server to handle SPSS 25 since SPSS 24 doesn't support checking out licenses on macOS High Sierra according to their support.

joethedsa
Contributor II

What would have to change in the script to convert this to a completely silent reactivation so there are no prompts for the end user (or computer that would be idle)? We have lab computers that we would like to proactively reactivate before a user opens SPSS 25 only to find it is not usable. Ideally we would only see a Jamf log whether or not it was successful or not.

smcmjeff
New Contributor III

I know this is a few months old, but I just wanted to say thanks for the script. We use an internal license server for our desktops and computer labs that have SPSS installed. However, we install the "Authorized user" version on faculty laptops. Like you, we seem to be constantly moving from one version to the next, while still having to support e-license previous versions. Your script provides an elegant solution to this issue.
Thanks again!

alavon
New Contributor

@joethedsa Sorry this is 5 months later, but if you just take out the if/then with the dialog boxes "osascript -e ...." it'll run silently.

#!/bin/sh
spssdir=$(find /Applications -name SPSSStatistics.app)

for spss in $spssdir; do
    spssver=$(plutil -p $spss/Contents/Info.plist | grep CFBundleShortVersionString)
    if [[ $spssver = *"24"* ]]; then
        cd $spss/contents/bin
        ./licenseactivator $4
    fi
    if [[ $spssver = *"25"* ]]; then
        cd $spss/contents/bin
        ./licenseactivator $5
    fi
done