Lets treat the cause, not the symptoms. There's a reason you are having shoulder pains. We need to figure out where it is, what it is and why it is occuring, and then work to correct it.
Performing machines over freeweights is not going to make a difference, in fact, I suggest to not use machines, especially for pressing movements. They alter the ROM, taking your joints into a differet alignment. Further, because you don't have to stabilize, your primary movers will get worked while many of your stabilization muscles will not. Do this long enough, and you will only exascberate the problem.
10bathrooms: Many people do not understand the benefits of doing a standing over head press. Those who do, often do not support the weight correctly. Far too often I see people pressing large weights, supporting the weight with their lower backs. The lower back is in excessive lordosis (arched), the pelvis is tilted anteriorly, and the shoulders and weight is behind the hips. This place all the weight onto the lower back. Try keeping your hips behind you and squeezing your glutes hard and keeping your abdominals tight while doing a standing over head press. No, you will not be able to lift as much, but you will be strengthening your core and improving form while doing so.
Br