Solved

Find OU with most computers in Active Directory

Posted on 2009-03-30
6
498 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 500 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
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…

752 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