Shutting down a launchagent with Casper?

jhuls
Contributor III

I'm needing to uninstall some software on High Sierra and Sierra but first I need to shut it down. Below is the launchctl line I can use if I want to shut it down when I'm logged in. How can I do this in an automated fashion through Casper? If I have to go through Self Service, that's fine but it would be nice to completely automate it.

launchctl unload /Library/LaunchAgents/com.xxx.yyy.plist
1 REPLY 1

mm2270
Legendary Contributor III

You just put that line into a script, or into the Execute Command field under the Files and Processes tab in a policy.
However, since it's a LaunchAgent and not a LaunchDaemon, your mileage may vary on how well that will work as is. Policies run shell commands as root, and LaunchAgents are in the user space, so it may not be able to disable the LaunchAgent without using some tricks to run it as the user. I'm certain that's necessary when enabling a LaunchAgent with a policy, but I'm not clear if it's also necessary when disabling one.