Forum Discussion
Amazing discovery about Guid's and how to use them to evenly distribute automation over time
- 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.
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.