microsoft / shell-intune-samples

Sample shell scripts for Intune admins.
MIT License
637 stars 213 forks source link

Issues with Dock script on MacOS 13 Ventura #73

Closed poindexter6 closed 1 year ago

poindexter6 commented 1 year ago

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?

m1lkman commented 1 year ago

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")
poindexter6 commented 1 year ago

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!

theneiljohnson commented 1 year ago

Nice, thanks… please do a pull request.

From: poindexter6 @.> Date: Thursday, 3 November 2022 at 15:47 To: microsoft/shell-intune-samples @.> Cc: Neil Johnson @.>, Mention @.> Subject: Re: [microsoft/shell-intune-samples] Issues with Dock script on MacOS 13 Ventura (Issue #73)

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 @theneiljohnsonhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ftheneiljohnson&data=05%7C01%7Cneiljohn%40microsoft.com%7Cea4059a60d2c4277c70e08dabdb2c44f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638030872773696780%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=ZscAzDWny2Rc%2FMktpQ5G%2FYGjIt1dAh%2Ff9f6iazk7DKE%3D&reserved=0 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!

— Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fshell-intune-samples%2Fissues%2F73%23issuecomment-1302311119&data=05%7C01%7Cneiljohn%40microsoft.com%7Cea4059a60d2c4277c70e08dabdb2c44f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638030872773696780%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=f1FDA4ZpzzyOzUP5uo9aCo6ptr783IudZTXfpZS1BhM%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAGOC2JOG72E3DBS7Z2XYCBDWGPNCPANCNFSM6AAAAAARVNLQ2E&data=05%7C01%7Cneiljohn%40microsoft.com%7Cea4059a60d2c4277c70e08dabdb2c44f%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C638030872773696780%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=u9VZXucc3j5nsZybGiNevgakGjy1mJB3oQfq69GJJxw%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

Nepenthe-x64 commented 1 year ago

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.

m1lkman commented 1 year ago

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
theneiljohnson commented 1 year ago

I think this is now resolved after m1lkman latest PR.