Need tool to show PC object and what OU they reside in

Posted on 2011-10-21
Last Modified: 2012-05-12
I have 47 sites in AD with Workstaions OU's and their local computers of the site.  i.e. '  I need a utility/tool that will output to CSV file every computer and the OU it sits in.  i.e  PC22-LA-08=somecompany/Sites/LA/Workstations/PC22-LA-08 etc.  I don't want a LDAP output.  Looking for one single CSV with 2500 or so PC's with column A having the PC name and column B showing the OU.

Not familiar at all with scripting, so hope there is an easier way to do this?  Anyone know of a tool or utility that can run through all 47 OU's to output this info?
Question by:NBquery
    LVL 37

    Assisted Solution

    by:Adam Brown
    LDFDE is a command line utility that can do this for you. has info on the syntax. Give me a minute and I can give you a direct command to use.
    LVL 37

    Expert Comment

    by:Adam Brown
    Or if you use the Quest Powershell Cmdlets here:

    You can just run the attached command. (Not exactly how you want it, since it includes the computer name in the OU output, but it should meet your needs)
    get-qadcomputer | select computername,canonicalname | export-csv <filename>

    Open in new window

    LVL 39

    Expert Comment

    by:Krzysztof Pytko

    You can use also for that Quest PowerShell module for AD. It's completely free and can be downloaded from
    then use this syntx to get required output
    Get-QADComputer -name * -SizeLimit 0 | Select name,ParentContainerDN | Export-CSV c:\output.csv
    You will get all computers in your domain with their name and OU to which they belong in CSV file
    and also, Distinguished Name (DN) of an object contains both values in it. CN=<name> is a computer name and the rest OU=<location>,DC=<domain>,DC=<local> its location in OU within Active Directory
    For that you can simply use DSQUERY command on a DC or workstation with installed Administrative Tools, use this structure
    dsquery computer -name * -limit 0 >c:\output.txt

    LVL 10

    Accepted Solution


    Refer this,  script searches Active Directory and report information about computer objects by santosh sivarajan. the script has two outputs one of them is creates an output file called ComptuerInfo.csv which contains all computer information.

    You can use simple OldCmp Command line Active Directory query tool.
    Please visit to download OldCmp.

    It generates a file called oldcmp_export.csv of all the systems in the domain within the hosting OU with their last system login time if available.

    Refer this blog for more info:

    Author Comment

    Thank you

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    At least once a month I see a Question in one of the Windows Server related Zones asking about Best Practices for GPO Security.  I have been in IT for 20 years, and a Sys Ad for over 15.  I know this will sound cliché, but this is mostly a preferenc…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now