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



The information in this article applies to:

  • Microsoft Exchange 2000 Server SP2

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 "COMPUTERNAME" with your Exchange Server name. 
   'TODO: Replace with the correct user name and the correct password.

    Set Locator = CreateObject("WbemScripting.SWbemLocator")
    Locator.security_.impersonationLevel = 3 'wbemImpersonationLevelImpersonate
    Set Service = Locator.ConnectServer("COMPUTERNAME", "root/MicrosoftExchangeV2", "Administrator","Password")
    Set Object = Service.Get("Exchange_DSAccessDC")
    
    wscript.echo Object.Path_.DisplayName
    
    SQLQuery = "Select * from Exchange_DSAccessDC"
 
    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
				

REFERENCES


For additional information about the Exchange_DSAccessDC class, visit the following Microsoft Developer Network (MSDN) Web site:For additional information about WMI, visit the following MSDN Web site:

Modification Type:MajorLast Reviewed:4/29/2004
Keywords:kbhowto kbMsg KB313711 kbAudDeveloper