Powershell to Get the count of user objects in Active Directory using LDAP Query

rated by 0 users
This post has 0 Replies | 1 Follower

Top 10 Contributor
Posts 211
Top Contributor
Krishna Posted: 09-12-2009 10:57 AM

Below powershell helps to get the list of user count from the Active Directory

$Domain = 'LDAP://DC=domain;DC=com'
$Root = New-Object DirectoryServices.DirectoryEntry $Domain
$select = New-Object DirectoryServices.DirectorySearcher
$select.SearchRoot = $root
$adobj= $select.findall() |? {$_.properties.objectcategory -match "CN=Person"}
$adobj.count

Regards,
Krishna
http://smtpport25.wordpress.com

Page 1 of 1 (1 items) | RSS
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.