I have a list of servers and need to find out what OU each one is in. I have searched and found something close but cannot get it to work properly. I am thinking there is a relatively easy way to do this but it eludes me. I have been trying to use the script found at the following link: https://gallery.technet.microsoft.com/scriptcenter/Retrieve-OU-for-Computer-7a062402 Does anyone know of an easy way to do this having it pull from a txt file using a foreach and querying against AD successfully
I tried a simple get-adcomputer servername which gave me a bunch of info including the OU, I want to build on this so it gives me just the OU for a list of servers
Thank you in advance for your time.