When you live there you know how to "fix" them but otherwise you are not obligated to fix them.
The buildings are occupied because the owner do not live there. Squatters target housings that are left empty by owners who are just speculating on the market.
I personally know a handful of cases where okupas tried to take people's primary residence that they just purchased and were in the process of reforming before moving, for example. And every single case was solved quickly by local police, as it's breaking and entering, not a occupation.
The sprays could be made very difficult to disconnect. A new one would activate each day in a new location. If day 1 spray is disconnected, day 2 would be twice as much volume.
It has been shown on Youtube that fart spray does work for theft, it's time to deploy it as an actual product everywhere.
If the okupas have been there for longer than 48 hours without you trying to get rid of them, doing something like that could be considered harassment and/or endangering the occupants' health, so you'd probably face criminal charges for it. You're not allowed to alter the living conditions to force them out, but you need to (within 48 hours of the occupation) legally get them out of the property.