I am looking to update our script which mounts shared files using Monterey. I believe the issue is python being out of date - any suggestions would be helpful. Here is our current script for Big Sur...
LoggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None]); username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
su "$LoggedInUser" -c '/usr/local/bin/dockutil --add smb://fs1.vcs.local/Shared\ Files --label 'Shared Files' --position end'
If this is not where this post belongs, please let me know
If you are using the latest dockutil package (rebuilt in swift) which removes python dependancy, try dropping the su to impersonate the logged in user.
I found updating their dock plist alone, was what now worked for me.