Solved

OUs and objects count command

Posted on 2016-09-29
1
103 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

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

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

Here's a look at newsworthy articles and community happenings during the last month.
After seeing many questions for JRNL_WRAP_ERROR for replication failure, I thought it would be useful to write this article.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

631 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