I would barricade the nest boxes with wire fencing or whatever is available. I would do this just before roosting time and remove it at daybreak. Every day for a week or two. It's a nuisance but it will force your birds to look elsewhere for a roosting spot and may or may not get them to use the roosting bar. When the barricade is removed permanently, they may continue their new habit of using the roosting bar. I did this with a single hen that was sleeping in a nesting box and it worked.
I have to wonder why your hens aren't using the existing roosting bar. Some possibilities:
Is the bar lower that the nesting boxes? That would make them want to roost in the nesting boxes.
Is the bar too high to jump up to? If so then add an intermediate step of some sort.
Is the roosting bar too narrow? Or not made of wood?
A picture would be helpful since we have no idea what your setup looks like. A picture might reveal the problem.