NY Real Prop Actions L § 776 (2021)
2021 New York Laws RPA - Real Property Actions and Proceedings Article 7-A - Special Proceedings by Tenants of Dwellings in the City of New York and the Counties of Nassau, Suffolk, Rockland and Westchester for Judg 776 - Judgment.

§ 776. Judgment. The court shall render a final judgment eithera.  Dismissing the petition for failure to affirmatively establish the   allegations thereof or because of the affirmative establishment  by  the   owner  or  a  mortgagee  or  lienor  of  record of a defense or defenses   specified in section seven hundred seventy-five of this article; orb. Directing that (1) the rents due on the date of the entry  of  such   judgment  from the petitioning tenants and the rents due on the dates of   service of the judgment on all  other  residential  and  non-residential   tenants  occupying  such  dwelling  from  such  other  tenants, shall be   deposited with the administrator appointed by  the  court,  pursuant  to   section  seven  hundred  seventy-eight of this article; (2) any rents to   become due in the future from all tenants occupying such dwelling  shall   be  deposited  with  such  administrator  as  they  fall  due;  (3) such   deposited rents shall be used, subject to the court's direction, to  the   extent  necessary  to  remedy the condition or conditions alleged in the   petition and (4) upon the completion of such  work  in  accordance  with   such  judgment, any remaining surplus shall be turned over to the owner,   together with a complete accounting of the rents deposited and the costs   incurred; and granting such other and further relief as to the court may   seem just and proper. A certified copy of such judgment shall be  served   personally  upon each non-petitioning tenant occupying such dwelling and   upon the city of New York by service as provided in subdivision five  of   section  seven  hundred seventy-one of this article. If personal service   on any such non-petitioning tenant cannot be made  with  due  diligence,   service  on  such  tenant  shall be made by affixing a certified copy of   such judgment on the entrance door of such tenant's apartment, store  or   other  unit  and,  in  addition,  within one day after such affixing, by   sending a certified copy thereof  by  registered  mail,  return  receipt   requested,  to  such  tenant. Any right of the owner of such dwelling to   collect such rent moneys from any petitioning tenant of such dwelling on   or  after  the  date  of  entry  of  such   judgment,   and   from   any   non-petitioning  tenant of such dwelling on or after the date of service   of such judgment on such  non-petitioning  tenant  as  herein  provided,   shall  be  void and unenforceable to the extent that such petitioning or   non-petitioning tenant, as the case may be, has  deposited  such  moneys   with  the  administrator  in accordance with the terms of such judgment,   regardless of whether such right of  the  owner  arises  from  a  lease,   contract,  agreement  or  understanding  heretofore or hereafter made or   entered into or arises as a matter of law from the relationship  of  the   parties  or  otherwise.  It  shall  be  a valid defense in any action or   proceeding against  any  such  tenant  to  recover  possession  of  real   property  for  the non-payment of rent or for use or occupation to prove   that the rent alleged to be unpaid was deposited with the  administrator   in accordance with the terms of a judgment entered under this section.