There are many commercial deterrents for animals that can be sprayed on lawns to keep animal off the grass but few work well if at all.

If you want a successful campaign against your enemy, you must understand how they think.

Dogs are driven by smell, they have sensitive noses and males try to mark their territory while females try to hide it.

In some cases, having the sent from another dog is a good deterrent. They would be unlikely to poop in another dogs domain just like people. That is why the smell around looking for the right place to poop.

Some people will spread chili pepper or cayenne pepper on a lawn to irritate the dogs. But that is all it will do, stinging their noses, burning their feet. While this does hurt the dogs, it only makes the owner angry and does nothing to prevent the dogs from pooping on your lawn.

Understanding that does are discouraged by smell, really anything offensive or out of the ordinary will keep them off the lawn.

Simple items found in your kitchen like vinegar or ammonia can be used to keep dogs out of the yard. However, using them dircetly on the lawn will do more damage than the dog poop.

These items can be put into open but covered containers around the lawn so the rain does not wash them away and render them ineffective.

This is usually enough to keep the dogs looking for alternate deposit areas to leave their poop.

It would be like a human entering a smelly bathroom, nobody wants to use it. So make it as unappealing as possible with strong odors that are not friendly to the dog.

Ammonia will keep anyone away, certainly animals.

You can also try ammonia soaked cotton balls in strategic areas so the dog will stay as far away as possible.

Unfortunately once the odor dissipates, the dogs will see it as safe again and come back and poop.