Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Find OU with most computers in Active Directory

Posted on 2009-03-30
6
Medium Priority
?
501 Views
Last Modified: 2012-05-06
Is there an easy way to find out which OU in Active Directory contains the most computers?

What about just a report of some kind to show the # of computers based on the container they're in, instead of a just a long list of all computers in Active Directory?

Using Windows XP and active directory is on windows 2003 server
0
Comment
Question by:garryshape
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 57

Expert Comment

by:Mike Kline
ID: 24019518
I use a tool called adfind to get the counts
http://www.joeware.net/freetools/tools/adfind/index.htm
So for the domain for instance
adfind -b dc=yourdomain,dc=com -f "objectcategory=computer" -c
I'm not sure if it can go and count per OU but I'll test and if I find a way using adfind I'll let you know
Thanks
Mike
 
0
 
LVL 71

Accepted Solution

by:
Chris Dent earned 2000 total points
ID: 24019588

PowerShell can though with a small amount of code.

You'd need this;

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

And this:

http://www.quest.com/activeroles-server/arms.aspx

To be able to run the little script below (it'll just paste into the Quest PowerShell window).

Chris
Get-QADObject -Type OrganizationalUnit | %{
  $ComputerCount = (Get-QADObject -SearchRoot $_.DN -Type Computer -Scope OneLevel).Count
  If ($ComputerCount) { $_ | Select-Object DN, @{n='ComputerCount';e={ $ComputerCount }} } }

Open in new window

0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 24019613

The second "GetQAD-Object" should have been substituted with Get-QADComputer as below. Although it really doesn't make much difference.

Chris
Get-QADObject -Type OrganizationalUnit | %{
  $ComputerCount = (Get-QADComputer -SearchRoot $_.DN -Scope OneLevel).Count
  If ($ComputerCount) { $_ | Select-Object DN, @{n='ComputerCount';e={ $ComputerCount }} } }

Open in new window

0
Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

 
LVL 57

Expert Comment

by:Mike Kline
ID: 24019634
I had a feeling powershell could do it
Ok going to see Brandon speak in April. I'm going to get the powershell bug :)
0
 
LVL 71

Expert Comment

by:Chris Dent
ID: 24019647

Sounds like fun, I hope you get a lot out of it :)

Chris
0
 

Author Closing Comment

by:garryshape
ID: 31564329
Thanks it works great
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Had a business requirement to store the mobile number in an environmental variable. This is just a quick article on how this was done.
Here's a look at newsworthy articles and community happenings during the last month.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

715 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