The only time this happened was at a very embarrassing entrance clinic. It was first grade which would have made me about 6. The clinic was presumably free, so if you couldn't or didn't want to afford taking your child to the pediatrician you could take them here. But thats a guess, at that age I knew very little except what was happening to me. They had the auditorium set up with all the exam stations on stage. There were partitions between, but they were open to the audience area, which is where the parents were all seated. You got undressed to your underwear and lined up. The very first station you went to had a rectal thermometer waiting for you. You were called in and placed over a nurses lap, undies were pulled down, and the thermometer was stuck in your bottom. I wasnt mortified, but definitely embarrassed. Not only could the "audience" all view this, but there were two nurses doing the temps so you were directly across from another child having his or her temp taken. This was the early '80s by the way, and children did not need privacy. I was on the side with my butt facing the audience, unfortunately, but it probably spared me from seeing everyone and feeling even worse. The child across from me finished in the middle of mine, and was stood up, had his thermometer read, entered on a chart that was handed to him, and the next child was called in. Of course, the other kids stared at you the whole time, as you did them. The worst was when they slid the thermometer out and stood you up in front of everyone.
But the most terrifying thing were the screams and cries coming from the end of the line. This is where you dropped your undies for the 3rd time (there was a testicle exam for boys), and got two terrifying shots in the hiney. Every kid screamed their head off, so it was quite unnerving knowing this was awaiting you. And, yes, I screamed too! My dad even commented on how bad those shots must have hurt.
Outside of that, it was always taken orally at school, even though it was taken rectally up to 12 by the doctors.