What i usualy do with queries like this is i pipe it and do a select on the objects i want. Here is an example of what I usualy do
Get-QADComputer -SearchRoot mydomain.name.com -DontUseDefaultIncludedProperties -IncludedProperties pwdLastSet, LastLogon, ParentContainerDN, description, location, managedby -SizeLimit 0 | sort ParentContainerDN | Select name, pwdlastset, LastLogon, ParentContainerDN, description, location, managedby | Export-csv c:\scratch\listcomputerinfo.csv -NoTypeInformation -sizelimit 0 specifies that you want everything otherwise there is a limit of about a 1000. With the sort command you sort them on the container you'd like Select makes sure you only get the tables you want. And im not really sure why I used -DontUseDefaultIncludedProperties -IncludedProperties but I think it speeds it up a bit so it doesn't use all the available objects which usualy takes a while. Hopefully its some use to you. Met vriendelijke groet, Erik Cramer [Description: Beschrijving: Beschrijving: Beschrijving: Beschrijving: Beschrijving: amcsmaller] Algemene Dienst ICT Workspace Management Academisch Medisch Centrum Meibergdreef 9 1105 AZ Amsterdam Zuidoost T: +3120 56 63737 E: e.j.cra...@amc.nl<mailto:e.j.cra...@amc.nl> L: HA1-069 From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On Behalf Of Jeremy Brown Sent: Wednesday, February 26, 2014 16:59 To: scripting@lists.myitforum.com Subject: Re: [scripting] RE: Script to list all AD OUs that conatin certain object types Do you need to attach that to the object? So you want two columns. One with the user, contact, or group name and one with the OU that object is in? On Wed, Feb 26, 2014 at 10:54 AM, Carneiro, Smita A. <carne...@purdue.edu<mailto:carne...@purdue.edu>> wrote: Can't you do something like, get a list of all OUs, for each, if a user or contact or group or... exist, pipe this OU name into a list. Then you can look at this list of OU names and target them with QAD Migration tools. Smita From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com>] On Behalf Of Lai, Jerry Sent: Wednesday, February 26, 2014 10:37 AM To: 'scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com>' Subject: RE: [scripting] RE: Script to list all AD OUs that conatin certain object types I actually don't really know or need to know the numbers, I just need the OU that the object belongs to. Example; I run these commands: Get-ADObject -filter {(objectClass -eq "User") -and (ObjectCategory -eq "Person")} | Export-csv C:\Temp\ADUsers.csv Get-ADObject -filter {(ObjectClass -eq "Contact")} | Export-csv C:\Temp\ADContacts.csv Get-ADObject -filter {(ObjectClass -eq "Group")} | Export-csv C:\Temp\ADGroups.csv Get-ADObject -filter {(ObjectClass -eq "PrintQueue")} | Export-csv C:\Temp\ADPrinters.csv Get-ADObject -filter {(ObjectCategory -eq "Volume")} | Export-csv C:\Temp\ADSharedFolders.csv Now I need to go into these csv files and manually clean them up to identify the different OUs listed within the DN column of each returned object. I want to cut through that manual work. From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com] On Behalf Of Jeremy Brown Sent: Wednesday, 26 February 2014 2:35 PM To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com> Subject: Re: [scripting] RE: Script to list all AD OUs that conatin certain object types How many users, groups, and contacts do you expect it to return? This sounds like it is going to be a very intensive, time consuming query. I don't know that you will be able to run it once and it work. There is a default 2 minute timeout on your commands in powershell, I believe. Also, I am not a fan of using cmdlets that have to be installed uniquely on a machine. If you wanted to use builtin powershell cmdlets you could issue something like this: Get-ADObject -SearchBase "ou=<TopLevelOU>,dc=domain,dc=extension" -LDAPFilter "(|(objectCategory=user)(objectCategory=group))" On Wed, Feb 26, 2014 at 8:49 AM, elsalvoz <elsal...@gmail.com<mailto:elsal...@gmail.com>> wrote: I Use powerGUI it should be able gather everything for you. Free On Feb 26, 2014 1:18 AM, "Lai, Jerry" <jerry....@hsf.com<mailto:jerry....@hsf.com>> wrote: Thanks for the reply Aakash. I'll have to look into the Quest cmdlet. My task is actually related to objects published in AD, so abything outside of AD I am not really concerned about. It's an information gathering task for the purpose of migrating to a new domain. We are using Quest Migration Tools to target OUs (that contain the highlighted objects) to copy/sync over to the new domain and that's why I need to identify those OUs. I have very little scripting skills and can only write very basic commands and was hoping someone had a script similar to what I was trying to find out. Thanks. From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> [mailto:listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com>] On Behalf Of Aakash Shah Sent: Wednesday, 26 February 2014 5:09 AM To: scripting@lists.myitforum.com<mailto:scripting@lists.myitforum.com> Subject: [scripting] RE: Script to list all AD OUs that conatin certain object types 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> [mailto:listsad...@lists.myitforum.com] On Behalf Of Lai, Jerry Sent: Tuesday, February 25, 2014 8:18 PM To: 'scripting@lists.myitforum.com<mailto: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<tel:%2B612%209225%205000> and delete the email. Further information is available from www.herbertsmithfreehills.com<http://www.herbertsmithfreehills.com/>. -- Regards, Jeremy Brown ITECS Systems NCSU -- Regards, Jeremy Brown ITECS Systems NCSU ________________________________ AMC Disclaimer : http://www.amc.nl/disclaimer ________________________________
<<inline: image001.png>>