Have you ever needed to find all computer accounts in a specific OU? You can try using Active Directory Users and Computers, but it is slow and inflexible. Another way to go is firing up PowerShell, loading the Active Directory PowerShell module and writing a script. When you need to retrieve a list of computer names, Get-ADComputer is the most useful cmdlet. You might want to restrict the output of your query by using –Filter and specifying the target OU via –SearchBase. And don’t forget to use Write-Host to make your report that much special! Add Export-Csv at the end, run the script, and then open the resulting csv file to examine the results of the commands you just wrote.
This looks like too much trouble just to get a list of computers in an OU. If you’re constantly pressed for time and have more important tasks on your plate, why don’t you automate the process of inventorying computer accounts with Netwrix Auditor for Active Directory? Its easy-to-read reports simplify routine tasks like finding all computer objects in your domain. You can filter the report to show only enabled (or only disabled) OU computers. If you need more detailed information about Windows Server computers in your network, you might want to take a look at Netwrix Auditor for Windows Server. It lists operating system versions, local users and groups, installed programs and other configuration properties, and even highlights possible security issues, such as an outdated OS or improper antivirus.