Executive Summary:
Use Microsoft Windows PowerShell scripting commands to query Active Directory (AD) to learn more about your Microsoft Exchange Server 2003 organization. |
In “Manage Exchange Server 2003 Using Windows PowerShell and WMI”
(http://www.exchangeprovip.com/Article/ArticleID/97261/97261.html), I explained how to exploit the strengths of PowerShell and Windows Management Instrumentation (WMI) to manage Exchange Server 2003. I also discussed how to assemble the interactive commands into a PowerShell script (*.ps1) and run the resulting script securely. In this article, I show you how to use PowerShell to query Active Directory (AD) to learn more about your Exchange organization.
Exchange and Active Directory
In “Manage Exchange Server 2003 Using Windows PowerShell and WMI,” we built the following WMI Query Language (WQL) statement, which includes a where clause:
$exmb = Get-WmiObject
-namespace root\microsoftexchangev2
-query "select * from
Exchange_mailbox where
(servername='exchangeserver01') and
(storagegroupname='First Storage Group')"
The purpose of the where clause is to filter the query so as to limit the search scope based on one or more criteria, thus optimizing the process. Only objects that satisfy the criteria will be returned to the machine executing the query itself. In order for this to function, you must already know the correct names to use to check against the criteria (e.g., exchangeserver01, First Storage Group), or you must have maintained an accurate record of them in the Exchange organization. . . .