I am writing a script to help us clean up AD and the horrible crimes that have occurred in it prior to my team’s formation. We have hundreds of OU’s, many of which don’t follow a naming convention and/or contain computers and users and servers. The idea is I input a OU and type and it will find all the objects of that type and then move them to the new OU structure we have made to make things sensible. What I can’t seem to figure out is how to convince get-adobject to return all the values of a particular OU (example: DC=demo,DC=contoso,DC=com)
Once I get the commandlet to pull the data I’ll parse it to do my bidding, but this simple hurdle has stumped me for hours. I clearly need more coffee and a nap, but in the mean time anyone care to show me what my mind has failed to figure out?