The Taipei District Court said among the four indicted, Yin Jo-yu was given a 40-day confinement, while Peng Cheng, Chen Po-yu and Tsai Ming-ying were each given a confinement of 30 days.
But all four were given a two-year suspension on the condition that they perform 120 hours of compulsory service to the Ministry of Education.
They can appeal the ruling.
The court said compulsory service could come in several forms, including safeguarding the safety of the Ministry of Education and cleaning and sweeping its facilities.
The students stormed into the office of the ministry complex on July 23 last year to protest against textbook guidelines which they believed promoted the idea that Taiwan and mainland China belonged to one country.
The Taipei Prosecutors Office later dropped charges of property damage and trespassing against 17 students.
But prosecutors indicted Yen Hsiao-ho and the four above for obstruction of official duty for allegedly scuffling with compound guards.
Only Yen was absolved of charges against him.
The students lodged the protest for what they claimed to be "an account of Taiwanese history presented from the perspective of Chinese unification" in the revision of curriculum guidelines.