As the other answer says, this advice comes from the Countess of Roussillon in act 1, scene 1 of All's Well that End's Well. The Countess gives it to her son Bertram as he leaves home after his father's death.
It would interesting to compare this advice to the advice Polonius gives his son, Laertes, as he heads off to France. Whereas Polonius is often a clueless, if ambitious, windbag, the Countess, in contrast, is sometimes considered one of the strongest characters in Shakespeare. She is a kind, strong, and gracious woman (if criticized for being a little too involved in her son's love life). Nevertheless, her heart is in the right place, and this is reflected in the kindness and sincerity of her advice to Bertram. She tells him to be kind, loving, and loyal, and to intimidate his enemies more with his "power"—their fear of what he might do to them—than any act against them.
The Countess of Roussillon's speech is as follows:
Be thou blest, Bertram, and succeed thy father
In manners, as in shape! thy blood and virtue
Contend for empire in thee, and thy goodness
Share with thy birthright! Love all, trust a few,
Do wrong to none: be able for thine enemy
Rather in power than use, and keep thy friend
Under thy own life's key: be cheque'd for silence,
But never tax'd for speech. What heaven more will
That thee may furnish and my prayers pluck down,
Fall on thy head!