Forum Discussion
JeremyTBradshaw
Jan 19, 2022Steel Contributor
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...
- 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.
JeremyTBradshaw
Dec 30, 2022Steel Contributor
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.
- JeremyTBradshawJun 28, 2024Steel Contributor
JeremyTBradshaw The_Exchange_Team would it be possible to stage a new property on mailboxes in EXO that is a string like ExternalDirectoryObjectId, but is just a copy of the Guid (ObjectGuid in underlying AD)?
I would like to include inactive mailboxes on my EXO mailbox reporting, which I am scheduling to happen in lightweight fashion around the clock using this Guid distribution system. New Gist about it - "The Power of the Guid for Even Distribution of Large Sets" . The problem with Inactive Mailboxes is that they don't have ExternalDirectoryObjectId's so this solution doesn't work for them currently.
If the Name property were consistently set like it is on some objects, as a string Guid, that would be useable, but it's not reliable since some accounts don't have their Name updated that way.
I've thought about using NetID, as it looks unique, always present (I think) and likely well-distributed like Guid's (not sure about this), however I saw that it is intended for internal use only and a few issues online about it (example). Would just love if in EXO PowerShell, the "Guid" property (i.e., ObjectGuid in EXO's AD), were a string, or if we could have a "GuidString" property that matches Guid, but is a string.