Script using credentials fails via Self Service

daniel_behan
Contributor III

I have a script to uninstall Zscaler that I want to run before upgrading an OS. When I run the script locally or via any policy not triggered by Self Service, it works. Even if I have a Self Service policy call a separate policy via a custom trigger. The Self Service policy doesn't apply the password and the GUI for the app comes up asking for the password instead.

#!/bin/sh

zspword=`echo 'passwordgoeshere' | base64 --decode`

/bin/launchctl unload /Library/LaunchDaemons/com.zscaler*

echo $zspword | sudo -S /bin/sh /Applications/Zscaler/.Uninstaller.sh

PIDS=`ps cax | grep "Zscaler" | grep -o '^[ ]*[0-9]*'`
if [ -z "$PIDS" ]; then
  echo "Process not running." 1>&2
else
kill -9 $PIDS
fi

exit 0
0 REPLIES 0