Deactivating and removing ARD and firewall rule

New Contributor III

I have some machines with Apple Remote Desktop turned on via /System/Library/CoreServices/RemoteManagement/ and some parameters for users.

Now I want to remove it for these machines. From what I can tell there are multiple parts to this:

  1. Turn of ARD and remove all access with /System/Library/CoreServices/RemoteManagement/ -deactivate -configure -access -off
  2. Remove the Firewall entry

To remove the firewall entry IF it exists is there a simple way to do this?
Or do I have to list all firewall rules, parse it, find and remove it?

So I've been playing around with this and now "/usr/libexec/ApplicationFirewall/socketfilterfw --list" doesn't list any rules for ARD even if it's turned on with "/System/Library/CoreServices/RemoteManagement/ -activate -configure -allowAccessFor -specifiedUsers".
I can however see the Remote Management and Screen Sharing rules in System Preferences Firewall Options...