次の方法で共有


Usage of Get-StoreQuery to query against the managed store

Exchange15 focusses on providing more Diagnostic information to customers. The Introduction of Managed Store feature in E15 provides a read-only access to the Store table.

Store Query is a function that basically uses Get-ExchangeDiagnosticInfo command in the background and provides output that would make sense to humans.

Through this Blog I am sharing a few ways I found the command could be used for some of the Basic troubleshooting,

 

However first, let us see how to load this command.

We first have to run the ManageStoreDiagnosticFunctions.ps1 script in the Shell.

[PS] C:\Windows\system32>cd "C:\Program Files\Microsoft\Exchange Server\V15\Scripts"

[PS] C:\Program Files\Microsoft\Exchange Server\V15\Scripts>. .\ManagedStoreDiagnosticFunctions.ps1

The method above is called Dot sourcing as script. It loads the script into Powershell session instead of just running it.

 

Display all the Tables in the Catalog

Get-StoreQuery -Database dbname -query "select * from Catalog" |ft

This command helps you get the list of all the Tables and TableFunctions in the catalog. Tables are basically present on the Disk, whereas the TableFunctions are present in the Memory.

 

How to find out the mailbox Number

Since you may need to use the MailboxNumber instead of displayname in most of the queries, and it is also easier to use the mailboxNumber, here is how we could get the list of Mailboxes on a specific database.

Get-StoreQuery -Database dbname -query "select * from Mailbox" |ft MailboxNumber,DisplayName

 

 

Alternately, if we know the displayname, we can find out the MailboxNumber and other details as below :

Get-StoreQuery -Database dbname -query "select * from Mailbox where DisplayName = 'tester1'"

 

 

Display information about a specific message in the Message table from the MID and MailboxNumber

Get-StoreQuery -Database dbname -query "select * from Message where MessageID = '0x9EAD721616F9D74B9CBF644606B6F49B000004A0D79D00000100' and MailboxPartitionNumber = '106'"

 We can obtain the properties of a message as below :

 

Find out the mailbox details based upon a UserSID

Scenario : We find out a specific Mailbox SID as the culprit, however we do not know which mailbox does the SID belong to.

Get-StoreQuery -Database dbname -query "select * from MailboxInfo where UserSID = 'S-1-5-21-3088144668-2606371049-731046914-2053'" |fl

Here, we have found out that the SID "S-1-5-21-3088144668-2606371049-731046914-2053" Belongs to the Health Mailbox, which wouldn’t have been listed from the Shell Window.

 

 

Find out the transactions that took place on a specific MessageID/FID or a Mailbox

Get-StoreQuery -Database dbname -query "select * from Events where MID = '0x812782A445F65B40A0A6608432BF2EBD0000E550867E0000'"

We may use this to track pervious transactions at database and mailbox level.

The results give out transactions which occurred in that order. It also mentions the Object Class, which may be the Message Class or the Folder Type on which the transaction took place.

 

 

Lastly, in order to make sure the Store Query function is working fine, we could run the command

Test-StoreQuery

 

 We could use store querying in lot many other ways, do share if you come across other helpful usages.

Hope this was a helpful start to using Managed Store querying!

 - Shweta

Comments

  • Anonymous
    May 30, 2014
    Good one nice to see some more blogs...
  • Anonymous
    May 30, 2014
    Nice Blog....
  • Anonymous
    June 03, 2014
    Great informative blog
  • Anonymous
    June 03, 2014
    Nice documentation.. way to go!
  • Anonymous
    April 12, 2016
    Nice information..
    • Anonymous
      May 12, 2016
      Thanks Deep :)
  • Anonymous
    May 12, 2016
    Thanks guys ^