use sudo to run as root.

then use this command

#!/bin/zsh

if [ -d "/Applications/Microsoft Defender.app" ]; then
    if [ -e "/Library/Application Support/Microsoft/Defender/uninstall/uninstall" ]; then
        /bin/echo "Using the uninstall option to remove Defender and any support files..."
        "/Library/Application Support/Microsoft/Defender/uninstall/uninstall"
    else
        /bin/echo "Deleting the Microsoft Defender shim from Applications..."
        /bin/rm -Rfd "/Applications/Microsoft Defender.app"
    fi
else
    /bin/echo "Microsoft Defender shim is not installed on this Mac."
fi

Leave a Reply

Your email address will not be published. Required fields are marked *