Solved

OUs and objects count command

Posted on 2016-09-29
1
57 Views
Last Modified: 2016-10-03
is there an easy way (possibly shell command) to list all OUs in a domain - a count of how many objects are within each of those OU's - and whether or not it is protected from accidental deletion?
0
Comment
Question by:pma111
[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
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 41821261
Try..
Get-ADOrganizationalUnit -F * -Pr ProtectedFromAccidentalDeletion -ResultSetSize $null  | Select Name, DistinguishedName,ProtectedFromAccidentalDeletion ,@{N="Count";E={(Get-ADObject -SearchBase $_.DistinguishedName -F * -ResultSetSize $null | Measure-Object).Count}} | Export-csv C:\temp\report.csv

Open in new window

Result gives the DN of OU and the total object count in the OU.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
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…

749 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