Solved

OUs and objects count command

Posted on 2016-09-29
1
24 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
1 Comment
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
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 to another domain controller. Log onto the new domain controller with a user account t…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now