Snape was a headmaster in Harry Potter and the Deathly Hallows .
Harry alerts the teachers that Voldemort is planning an assault on the school , and they drive out Snape and summon the Order of the Phoenix to help defend the school to win time for Harry to locate the horcrux .
Harry Potter and the Deathly Hallows