To be clear, I am referring to the books ONLY and not the movies (as I don't like them).
In the Deathly Hallows when Harry and the others break into Gringotts to steal the horecrux from Bellatrix's vault, their cart passes through a waterfall which "washes off" all magical enchantments. As Griphook says-
It washes away all enchantment, all magical concealment! They know there are imposers in Gringotts, they have set off defenses against us!
If this enchantment was so useful, why wasn't something like this cast around Hogwarts? Because something like this would surely be useful during Voldemort's reign of terror and also when he returned.
Fake Mad-eye (Crouch Jr) got into Hogwarts in a disguise. Quirrell got in too.
Wouldn't so many things be avoided if something like this was put up?