The groups, contacts and users should be pretty simple.  You can use the Quest 
cmdlets to gather this information using get-qadobject.  This will return a 
"Type" and you can further filter from here.

The printers may be harder since unless you chosen to publish them in the 
directory, AD has no idea about them afaik (but someone please correct me if 
I'm wrong).  However, one possible approach may be to target the Group Policies 
that are used to deploy the printers to specific OUs, and then query those GPs. 
 I've never done this, so I don't have any information about this.

The shares are also not guaranteed to be in AD since unless you've chosen to 
publish them in the directory, they won't be there.  Depending on how your file 
server is setup, it may be possible to query the GPs for this information too, 
but since shares are not tied to OUs, I'm not sure how to do this definitely.

-Aakash Shah

From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Lai, Jerry
Sent: Tuesday, February 25, 2014 8:18 PM
To: 'scripting@lists.myitforum.com'
Subject: [scripting] Script to list all AD OUs that conatin certain object types

So I've been tasked to find all OUs that contain specific types of objects, 
them being; users, groups, printers, shares and contacts.

I have a few powershell command lines that can output all objects to a csv 
file, which will then require quite a bit of manual tidy up.

Does anyone have a script that can do something similar or is there a better 
way of finding this info?

Thanks,
Jerry



Herbert Smith Freehills LLP and its subsidiaries and Herbert Smith Freehills, 
an Australian Partnership, are separate member firms of the international legal 
practice known as Herbert Smith Freehills.

This message is confidential and may be covered by legal professional 
privilege. If you are not the intended recipient you must not disclose or use 
the information contained in it. If you have received this email in error 
please notify us immediately by return email or by calling our main switchboard 
on +612 9225 5000 and delete the email.


Further information is available from 
www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>.




Reply via email to