You are correct you do not want them roosting in, on or on the side of the nesting boxes, it makes for dirty eggs once they start laying.
You don't say if they are roosting on the lip of the boxes or on a perch in front of the nesting boxes.
If they are roosting on the lip I would start by moving them to the roost each night at dusk when you lock up to the actual roosts, in many cases this "retrains" them and solves the problem. If this doesn't work try hanging a piece of cloth over the nesting hole. Leave about two inches between the sides of the box and the cloth, this will help the hens get in when they start laying.
If they are roosting on the perch in the front the first thing I would do is to make the perches so that they can be lifted up in front of the nest openings to prevent roosting or remove them.
Hope this helps.