microsoft / shell-intune-samples

Sample shell scripts for Intune admins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with Dock script on MacOS 13 Ventura

poindexter6 opened this issue · comments

The dock script is still working fine on fresh machines running MacOS 12 Monterey, but I have not seen the dock successfully update for any new machines booting on MacOS 13 Ventura.

Is there something wrong on my side or is a change needed for the script?

if you're trying to pin the preferences app (now called settings) like I do I had to add to following to the script. Maybe @theneiljohnson likes it? I can do a pull request.

# workaround for Ventura (macOS Ver 13.x) System Settings.app name change
productVersion=$( /usr/bin/sw_vers -productVersion )
if (( $(echo "$productVersion > 12.9" | bc -l) )); then settingsApp="System Settings.app"; else settingsApp="System Preferences.app"; fi

dockapps=( "/Applications/Microsoft Edge.app"
            "/Applications/Microsoft Outlook.app"
            "/Applications/Microsoft Word.app"
            "/Applications/Microsoft Excel.app"
            "/Applications/Microsoft PowerPoint.app"
            "/Applications/Microsoft OneNote.app"
            "/Applications/Microsoft Teams.app"
            "/Applications/Visual Studio Code.app"
            "/Applications/Company Portal.app"
            "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
            "/System/Applications/App Store.app"
            "/System/Applications/Utilities/Terminal.app"
            "/System/Applications/$settingsApp")

if you're trying to pin the preferences app (now called settings) like I do I had to add to following to the script. Maybe @theneiljohnson likes it? I can do a pull request.

# workaround for Ventura (macOS Ver 13.x) System Settings.app name change
productVersion=$( /usr/bin/sw_vers -productVersion )
if (( $(echo "$productVersion > 12.9" | bc -l) )); then settingsApp="System Settings.app"; else settingsApp="System Preferences.app"; fi

dockapps=( "/Applications/Microsoft Edge.app"
            "/Applications/Microsoft Outlook.app"
            "/Applications/Microsoft Word.app"
            "/Applications/Microsoft Excel.app"
            "/Applications/Microsoft PowerPoint.app"
            "/Applications/Microsoft OneNote.app"
            "/Applications/Microsoft Teams.app"
            "/Applications/Visual Studio Code.app"
            "/Applications/Company Portal.app"
            "/Library/Application Support/Microsoft/MAU2.0/Microsoft AutoUpdate.app"
            "/System/Applications/App Store.app"
            "/System/Applications/Utilities/Terminal.app"
            "/System/Applications/$settingsApp")

This worked, thank you!

This bit specifically is not working for me in testing.

# workaround for Ventura (macOS Ver 13.x) System Settings.app name change
productVersion=$( /usr/bin/sw_vers -productVersion )
if (( $(echo "$productVersion > 12.9" | bc -l) )); then settingsApp="System Settings.app"; else settingsApp="System Preferences.app"; fi

When I run the above on macOS 13.0.1 I am getting:
Parse error: bad expression
<stdin>:1

I'm newer to macOS / Bash, so take it easy on me. :)

Any help is greatly appreciated.

Looks like bc can't handle the comparison when there's more than one decimal. Try this instead.

# workaround for Ventura System Settings.app name change
if [[ -a "/System/Applications/System Settings.app" ]]; then settingsApp="System Settings.app"; else settingsApp="System Preferences.app"; fi

I think this is now resolved after m1lkman latest PR.