Fair warning: if you haven't yet read Harry Potter and the Order of Phoenix, you may be spoiled.
As Hermione always said, it's impossible to penetrate Hogwarts' defenses. In Harry Potter and the Order of Phoenix, when Harry saw Mr. Weasley from Lord Voldemort's snake's eyes, Hermione told Harry that it's impossible to apparate into Hogwarts and Voldemort had no access to Harry. However, at the end of the book, Dumbledore sent Harry to Hogwarts using a Portkey. So why didn't Lord Voldemort use a Portkey to get into Hogwarts?
Edit: After Harry saw Mr. Weasley from Nagini's, Dumbledore sent Harry and the Weasleys out of Hogwarts using a Portkey.
as I said in comment, Dumbledore was in ministry of magic and he couldn't do any magic from there on Hogwarts protections.