Hi @alliehodge You may want to consider putting in the full path to the sgdeadmin
binary in the command in the script that pulls the version. Its possible you're running into a case where the PATH variables in the context of the script being run in the EA (usually run as root) doesn't know what sgdeadmin
resolves to, such as in this case, it should resolve to the full /usr/bin/sgdeadmin
or /usr/local/bin/sgdeadmin
. When you run a manual recon, the Mac is using a different PATH setting, so it may be able to resolve it correctly in that case.
So for example, you could modify you're script to look like this:
#!/bin/bash
if [[ -e /usr/bin/sgdeadmin ]]; then
SGDEADMIN="/usr/bin/sgdeadmin"
elif [[ -e /usr/local/bin/sgdeadmin ]]; then
SGDEADMIN="/usr/local/bin/sgdeadmin"
fi
if [ "$SGDEADMIN" ]; then
echo "<result>$(${SGDEADMIN} --version | grep Version | awk '{print $NF}')</result>"
else
echo "<result>SafeGuard Not Installed</result>"
fi
The above first looks for the binary in one of two possible locations. Whichever one it finds it in, it sets a variable to use for the command later. Then, if the variable is populated, it runs the command, using that variable. If $SGDEADMIN is not populated, it means the script couldn't find the binary, so its not installed and reports "SafeGuard Not Installed"
Give this a try and see if it works.
Oh, one last thing, I can't test this since I don't have SafeGuard, but I assume you can remove the grep
and use awk's regex matching to pull the version info and the correct column in one line, like this:
${SGDEADMIN} --version | awk '/Version/{print $NF}'