Hello !
I have a script that runs fine when I execute it from self service, but it fails when I try to push it with a policy. The problem resides when I want to open the app with the command: osascript -e 'open app "application name"'
I have an error type -10822 when run from the policy but works fine in self service. I also tried to execute that command with sudo -u $loggedInUser osascript -e 'open app "application name"' or with su $loggedInUser osascript -e 'open app "application name"' but no way. If I make a script locally to use the open command, it's fine when run as the logged user but if I run as root and use the $loggedInUser variable in the script, it fails.
Any idea to help me to resolve this ?
It's on a Big Sur mac with Apple M1 chipset.