Pursuant to the procedure provided in the Maryland Rules, the court may make an appropriate order directing, restraining, or otherwise controlling the conduct of a person who is properly before the court under this subtitle, if:
(1) The court finds that the conduct:(i) Is or may be detrimental or harmful to a child over whom the court has jurisdiction;(ii) Will tend to defeat the execution of an order or disposition made or to be made; or(iii) Will assist in the rehabilitation of or is necessary for the welfare of the child; and(2) Notice of the application or motion and its grounds has been given as prescribed by the Maryland Rules.