I hope you don't mind, but I'm going to ask and answer a question here. However, I'd like to see alternate approaches.
I'm dumping a list of user accounts from AD and I'd like to sort them by OU. The DN lists the cn first which screws this up as a sorting key without modification. After some poking around, I realized canonical name has exactly what I need. It lists the object location in the form of: