Here's my answer from another post. Another BYC'er commented that they did what I said here and havn't had any further snake problems.
If you want to discourage snakes, you must make sure that your yard in general, but especially around your chicken pens is competely clear and mowed. Leave no bushes or junk piles for them to have cover to hide under. Snakes hate crossing open areas without the cover of brush and high grass becuase it leaves them vulnerable to bird predation. Second, fill the gaps or holes around your pen with spray insulation foam. Third, if you can, keep baby chicks in brooder and grow out pens constructed with 1/4 inch hardware cloth. Fourth, collect your eggs regularly. Leaving eggs out provides opportunity and temptation. Lastly, cut down or eliminate your rodent population, which is probably what attracteda snake to your place initially. I klnow, people always say they don't have a rodent population, but you probably have more rodent's around your pens than you realize. Mice love to drink from water dishes, eat fallen food, and so do rats. So, keep the food stored in rodentproof containers, put uneaten food away at night, don't spill food when you are feeding. Use exclusion and traps to reduce your rodent population. Do these things and you will have less snakes. It's that simple.
Here is the other BYC'er comments:
I had a severe snake problem in my area and took all this advice and it WORKED! You'd be suprised how cleaning up and using that spray foam can make a world of difference. I also put mothballs in old milk jugs with holes punched in them (to let the smell out) under places like my back deck and by the coop.