Link to home
Start Free TrialLog in
Avatar of Vernon Young
Vernon YoungFlag for United States of America

asked on

Script to Find an Unload File

I need to write a script that will find all plist files in /Library/LaunchAgents/ that start with connectwisecontrol and contain onlogin in the file names then unload them.

We use ConnectWise Control for providing remote support to our users. The client is installed on the machine and runs at boot. The problem is that we have an application that is used a few times per year that conflicts with ConnectWise Control. Our solution is to close ConnectWise while the other application is running.

Running the following:

launchctl unload /Library/LaunchAgents/connectwisecontrol-xxxxxxxxxxxxxxxxx-onlogin.plist

That closes the ConnectWise Agent running in the background and allows the other application to work fine.

My ideal solution would be to use Automator or create or package a script that runs that command and then kicks off the other application when the user clicks it.

The part that I'm unsure of is how to write a script that finds the plist. The xxxxx's in that file vary depending on the computer. I need to search for that plist and then insert it into the unload statement.

Any guidance would be greatly appreciated!

Vernon
ASKER CERTIFIED SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vernon Young

ASKER

That worked perfectly! Thanks so much!