A lot of people get this wrong.
It’s not that Gandalf or Saruman or any other Maiar sent to Middle-earth as Istari were forbidden to use force.
They were forbidden to seek dominions of their own — to use their power to get Men or Elves or Dwarves to serve them and name them lord.
They were forbidden to try to defeat Sauron by matching their power against his directly; they were not to set themselves up as his direct counterparts and engage him directly as the celestial beings that they were.
They were forbidden to reveal themselves as the beings of great power and majesty that they were. This doesn’t mean that they could never use their powers. It ties back to the first point; if people knew what they really were, and could see them as beings of divine power, they’d be inclined to follow them, serve them, and do whatever they say because of what they are rather than because a particular choice was the right thing to do. So they were supposed to veil their true nature by taking on the form of old men, and by only using their inherent power at great need.
But they could use their power. It was their intentions that were really under restriction.
The mission of the Istari was to serve as guides for the free peoples of Middle-earth, to help them make the right choices and do the right thing. Their mission was not to take over and say, “We have been sent by the Valar to rule over you and order your realms so as to build up the strength to confront and defeat Sauron under our command.” Their mission instead was to give advice and counsel, to help Men and Elves and Dwarves find the right path, to encourage them to resist Sauron and to help each other and those in need, when the natural inclination of all three races (under the influence of first Melkor and then Sauron) was to isolate themselves from the others and serve only their own selfish interests.
But there’s this mythical belief that seems to have spread that somehow if a wizard used his powers in any way or in any context he was breaking the rules. First of all, the “rules” were pretty vague, and were never fleshed out in any kind of final form by Tolkien himself. He refers vaguely to the mission of the Istari and the restrictions they were under in a few of his letters, and he spells things out a bit more in the totally unfinished and fragmentary writings he left behind on the Istari before he died, which were later compiled, with significant editorial commentary, by Christopher Tolkien in Unfinished Tales. It would be a huge mistake to assume that this fragmentary account based on scattered and incomplete pages of notes, some of which were barely legible, and none of which were in anywhere close to publishable form when Tolkien died, as his final and settled thoughts on the matter. Even so, what we have from Tolkien does not at all say they cannot use their powers, nor does it really support the idea that there were hard restrictions on their powers. Tolkien suggests that taking on their physical forms imposed certain limitations on them; they couldn’t remember all that they knew from their experience as beings of pure spirit dating back to the creation of the world (they had these memories, sort of, but were more like the way humans remember dreams). They could grow weary, and they needed food and sleep and their bodies could be broken or slain, and the fact that their knowledge and memory of who and what they really were was foggy meant they could stray from their mission or be tempted toward evil.
But beyond that, the “rules” such as they were really were about not taking over and trying to solve the problem of Sauron themselves; they were to direct and encourage others to resist him. They were sent as guides, not rulers or warriors. It wasn’t even necessarily against the “rules” to let a few beings in Middle-earth know what they really were or where they came from; certainly, Cirdan the Shipwright knew or had an idea, since he saw them arrive on ships out of the West, and Elrond and Galadriel seem to have had a pretty good idea. Even Frodo, at the end of Return of the King, seems to have an idea of what the Istari were, when he refers to Saruman as having once been of a kind so great and majestic that the Hobbits would not have dared raise a hand to harm him. The point of the “rules’ was basically, “Don’t show up on the shores of Middle-Earth looking and acting like an Angel, because then people will follow you and listen to you solely because they are awed by what you are. Don’t personally try to throw down Sauron by overpowering him yourself. Don’t try to set up your own realms or use your powers to make others serve you.” It was not, “Never use your powers,” nor was it, “Well, ok, use your powers, but only like at 20% strength.” They were supposed to be guides and counselors, not rulers or lords or heroes. That’s really the extent of it.