# PowerShell Counts objects
in Active Directory
# Connect to hard-coded root
# Author: Guy
Thomas
# Version 1.5 Sept 2007 tested on PowerShell v 1.0
and RC2
$Dom = 'LDAP://DC=csed;DC=cs;DC=luc;DC=edu'
$Root =
New-Object DirectoryServices.DirectoryEntry $Dom
# Create a
selector and start searching from the Root of AD
$selector =
New-Object
DirectoryServices.DirectorySearcher
$selector.SearchRoot = $root
$adobj=
$selector.findall()
"There are $($adobj.count) objects in the
$($root.name) domain"