Hakim al-Umma Mawlana Shah Ashraf Ali Thanawi ra said:
“There are two prerequesites for amr-bil ma’ruf (instructing good);
Firstly, there should be hope that the individual being spoken to will accept or at least will not harm you (in retaliation).
The other is that the individual must be unaware of that good deed.
Mostly in the cases of lack of knowledge the chance of instruction being accepted are better. Whereas, people already aware of the good deed are often annoyed if instructed to perform it.
Dawat o tablig ki sharaii hasiyat, page 26