Forum Discussion

JeremyTBradshaw's avatar
JeremyTBradshaw
Steel Contributor
Jan 19, 2022
Solved

Amazing discovery about Guid's and how to use them to evenly distribute automation over time

I recently re-discovered something, only this time was equipped to take advantage.  I place this post here in the Exchange forum since this is my area of most interest, especially relating to using t...
  • JeremyTBradshaw's avatar
    Dec 30, 2022

    Just wanted to share an extra finding that really makes the above solution shine - it is that in Exchange Online, ExternalDirectoryObjectId is stored as a string! This means we can easily do this:

    Get-Mailbox -Filter "ExternalDirectoryObjectId -like 'a*'

    and this will give us back pretty much exactly 1/16th of all of our EXO mailboxes.  The same cannot be accomplished with any of the other GUID-based properties, which are stored as GUID's.  For example, this doesn't work properly:

    Get-Mailbox -Filter "Guid -like 'a*'"

    If anyone happens to know how to filter with -like and against actual GUID properties, I'd love to see it. But for now and thanks to how they've decided to store ExternalDirectoryObjectId, we have a perfect solution for getting back some predictable set of mailboxes which represent a very predictably sized subset of all mailboxes.  So we can easily spread work across multiple days and know that we'll cover all mailboxes in whatever number of days we choose to spread the hexadecimal characters across. 

Resources