Sometimes it will work for some of the pest. Deer, some rabbits, even some dogs and cats will walk right through it. I have never seen it work for bugs. Snakes aren't too fond of it though.
I successfully deterred a young rabbit last year that was eating my beet tops. Sprinkled some cayenne powder on the leaves every few days or so, and he never ate them again.
There are many uses for kitchen spices. Some are used to spice up our lives and some are used as kritter ridders. Unless you have a pepper farm you may want to try companion planting. Some spices just belong in food and not in dirt.
It did not find it to work that great for me. I would recommend to use borax. I was told about it from some friends who garden and it worked really well in our garden. It got rid of all the creepy crawly's as my son would say. Good luck!