Getting exchange database location. RRS feed

  • Question

  • Hi guys,

    I don't know if this should be in the exchange part of the forum but here goes.

    I am trying to make a .NET application that will fetch the location of the active exchange databases (EG: D:\Exchsvr\),
    Re-curse through that directory, and add up the total amount of disk space in use by any EDB & STM files in that location.

    The problem I have encountered is that I can't seem to find any reference to the location of the databases within windows (I have looked through XML and INI files and scoured the registry with no results.)

    I found on several sites that I could use ADSI to accomplish this but I have yet to test this.
    Is anyone aware of method to find the location of the active databases without using ADSI or re-cursing through every folder on every drive?
    the Re-curse method is definetely a no-go as many of our clients create full backups of their databases which would result in multiple false entries not to mention the disk performance would nose dive during the search.

    Any help would be appreciated.

    • Moved by Mike Feng Monday, May 14, 2012 10:56 AM Exchange (From:Visual Basic General)
    Sunday, May 13, 2012 2:16 PM

All replies

  • I have to ask... what would your application possibly do with this information?  I'm also not sure that you can count on every EDB file being an active information store...

    The reason I ask is because whatever you might do, you should typically manipulate Exchange from within Exchange (or related client/management utility) and if your code was running internally then you'd surely have access to the information store location via the chosen API.

    You might want to look through the Exchange Developer Center and see if there's a better way to go about what you are trying to do.  Take a look at the different SDKs and determine which layer would be best suited to the process you need to implement.  It seems likely that one of them would be suited to handle whatever you're trying to do.

    Or, if you're sure you are on an acceptable development path and really just want an answer to this specific question, then it probably would be best to ask on the Exchange forums:

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Sunday, May 13, 2012 2:57 PM
  • Thanks for the reply Reed.

    Here is my goal.
    I have many servers ranging from Server 2003 to 2011 with varying versions of exchange.
    I want to write an application that I can upload and run on the machine (uploaded and executed remotely using 3rd party tools).

    I need my app to find the location of the EDB/STM on the server (if any) and output that directory to a text/csv/xml file.

    The location of the database is held in ADSI under:

    Configuration>Services>Microsoft Exchange>ORGANIZATION-NAME>Administritive Groups>Servers>SERVERNAME>STORAGEGROUPNAME>Mailbox Store.

    Within that file there is a field called: msExchEDBFile which holds a value like:

    C:\Program Files\Exchsrv\mdbdata\priv1.edb

    it is this value that I need to extract using my program.
    Normally I would have just read a registry entry but I can't find anything anywhere that holds the current path of the EDB/STM files apart from ADSI.
    If I were to recurse through the drives it would definitely find the EDB/STM files but it would also find old EDB backups etc and the disk space performance with deteriorate.

    My end goal is to get the overall size of the EDB/STM files and compare it to the Maximum database size that exchange allows (which is in the registry)

    HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MSExchangeIS\<var>Server name</var>\Private-<var>Mailbox Store GUID\</var>Database Size Limit in Gb

    This data will then be uploaded by my 3rd party tools and centralized into a single DB which I can then report on showing how much GB each database has left before the Info store starts dismounting.

    Hopefully this clears things up a bit. If anyone knows a way to get this information either from ADSI or another method that I have overlooked then let me know.

    Thanks again for the reply Reed, I will look through the developer centre.

    Sunday, May 13, 2012 4:25 PM