I am needing to return all objects in the default Users container in Active Directory. The current container (it is not an OU) houses the following: contacts, users, security groups, and distribution groups. Is there a way in powershell to return a listing of all these objects in the users container?
Welcome to the forum.
What have you tried so far?
This forum is for scripting questions rather than script requests. We do not write customized and ready to use scripts or solutions on request.
We actually expect you to make an own attempt at the first place to get your task done or to solve your problem. If you have done so already please document here what exactly you have done and show your code. Then we probably might be able to help you step further.
I prepared a quick Google search for you:
Thanks Olaf and I was not looking for a specific script, just the language on how to search container and not an OU. I cannot tell you how many times I searched for searching a container in AD using powershell and all I received were things unrelated to what I needed. Your link, however, provided exactly what I needed (replacing OU with CN). I really appreciate the reply…you have helped tremendously. Blessings upon you!
But there’s actually no difference. The way you provide an OU for a “
Get-AD...” cmdlet or a container is by providing a path to it with the paramter “