Whenever, under the provisions of a will, it shall be necessary for the personal representative to retain in his hands the personal estate, or any part thereof, after all just claims are discharged, as where money or some other thing is directed to be paid at a distant period, or upon a contingency, the circuit court of the county in which such personal representative qualified, or the judge of such court in vacation, shall have the power, on the application of such personal representative, or of a party interested, after ten days' notice to all parties interested in the retained funds or estate, to decree and give directions thereto; and in any such case it shall be the duty of such personal representative to make such application to such court, or judge thereof in vacation; and such court, or judge thereof in vacation, shall have full power to decree or direct what part of the personal estate shall be retained or appropriated for the purpose, in what manner it shall be disposed of, how the legacy or benefit intended by the will shall be secured to the person to be entitled at a future period or contingency, how the necessary part of the personal estate to be appropriated for the purpose shall be prevented from being unproductive, and how it shall be applied, agreeably to the intent of the will or the construction of law, in case the contingency shall not take place.
W. Va. Code § 44-6-5