Microsoft KB Archive/313711

= How to use the DSAccess WMI provider to retrieve information about the Active Directory domain controllers and the Exchange Server domain controllers =

Article ID: 313711

Article Last Modified on 4/29/2004

-

APPLIES TO


 * Microsoft Exchange 2000 Server Service Pack 2

-



This article was previously published under Q313711





INTRODUCTION
This article contains a sample script that describes how to retrieve information about the Active Directory domain controllers that are accessible to the Microsoft Exchange 2000 Server DSAccess service. The following sample script shows how to retrieve information about the Active Directory domain controllers by using the Windows Management Instrumentation (WMI) provider. Look for the following namespace in the sample script:

\\COMPUTERNAME\ROOT\MicrosoftExchangeV2:Exchange_DSAccessDC 'TODO: Replace &quot;COMPUTERNAME&quot; with your Exchange Server name. 'TODO: Replace with the correct user name and the correct password.

Set Locator = CreateObject(&quot;WbemScripting.SWbemLocator&quot;) Locator.security_.impersonationLevel = 3 'wbemImpersonationLevelImpersonate Set Service = Locator.ConnectServer(&quot;COMPUTERNAME&quot;, &quot;root/MicrosoftExchangeV2&quot;, &quot;Administrator&quot;,&quot;Password&quot;) Set Object = Service.Get(&quot;Exchange_DSAccessDC&quot;) wscript.echo Object.Path_.DisplayName SQLQuery = &quot;Select * from Exchange_DSAccessDC&quot; Set DSAobjColl = Service.ExecQuery(SQLQuery) For Each DSAobj In DSAobjColl wscript.echo DSAobj.Name wscript.echo DSAobj.ConfigurationType wscript.echo DSAobj.Type wscript.echo DSAobj.DirectoryType Next

set Service = nothing set Locator = nothing

Additional query words: Exchange_DSAccessDC wmi wbem

