Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # The goal of this script is to install a profile for each login user on a Mac
- # device, taking into consideration the discrepancies between the profiles tool
- # on High Sierra versus older versions.
- # The should combine to create the absolute path of the profile
- profileName='/test cert.mobileconfig'
- profilePath='/Library/Addigy/ansible/packages/Certificate Test'
- # Set permissions for the certificate
- chown -R root:staff "${profilePath}"
- chmod -R 775 "${profilePath}"
- # Grab macOS version
- macOSVersion=$(sw_vers -productVersion | awk -F. '{print $2}')
- echo "Detected: macOS version 10.${macOSVersion}"
- if [ "${macOSVersion}" = "" ]; then
- echo "Error: Couldn't pull macOS version."
- exit 1
- elif (( macOSVersion >= 13 )); then
- echo "Running 10.${macOSVersion} install."
- for user in $(dscl . list /Users UniqueID | awk '$2 >= 500 {print $1}'); do
- /usr/bin/profiles install -user $user -path "${profilePath}${profileName}" -forced
- done
- else
- echo "Running 10.${macOSVersion} install."
- for user in $(dscl . list /Users UniqueID | awk '$2 >= 500 {print $1}'); do
- /usr/bin/profiles -IF "${profilePath}${profileName}" -U $user
- done
- fi
Add Comment
Please, Sign In to add comment