Counsel for the Catholic Diocese of Auckland, Michael Robinson, said the occupants of the boarding facilities were there in an agreement with Hato Petera Limited, but will now have seven days to vacate the hostel.
There were also issues with the fitness of the boarding facilities and potential fire risks, the court heard.
The boarding facilities were to be vacated and possession of the property delivered to the Catholic Church, the court heard.
A further hearing has been scheduled later this year between the church and a third party.
Hato Petera Limited filed the injunction independently from Hato Petera College.
However, housing and family support provider De Paul House had signed a two-year lease with the church, allowing it to house homeless at the hostel, which had angered some in the Hato Petera community, Radio New Zealand previously reported.
The Herald has previously reported on several issues at Hato Petera College, including the roll falling below 100, dilapidated buildings, bullying, infighting and a lack of confidence from the church.
Last year the boarding facilities were closed for college students and boarding is no longer offered.
This year the college has been operating for day students only, with a small staff and just 25 students enrolled to start 2017.
The college's history began in 1850, when more than 141ha in Northcote was entrusted to the Catholic Church for Maori education and the poor.
The school has had various names during its history, including St Mary's Industrial School for Maori Boys and St Peter's Maori College, before it changed its name to Hato Petera in 1972.
Among its past students are Dr Ranginui Walker, the late emeritus professor of Maori studies at Auckland University, All Black Walter Little, the late artist Ralph Hotere, ONZ, and former New Zealander of the Year Dr Lance O'Sullivan.