Uniquely identifying mailboxes
I know AD accounts have SID's to uniquely identify them, does anyone know what the corresponding value for an Exchange mailbox is? And how can I search by this? For instance, if a mailbox has a identifier of MBX1, how could I pull up info about it, Get-mailbox -? Applies to Exchange 2007 SP2.
February 15th, 2011 3:04pm

Exchange mailboxes uses GUIDs to identify a user account.
Free Windows Admin Tool Kit Click here and download it now
February 15th, 2011 3:18pm

Ok, great... If I had a mailbox with GUID #1, how can I get properties for it? What Powershell command will 'get' a mailbox with that specific GUID?
February 15th, 2011 3:19pm

On Tue, 15 Feb 2011 19:56:12 +0000, Smith1974 wrote: >I know AD accounts have SID's to uniquely identify them, does anyone know what the corresponding value for an Exchange mailbox is? The AD property is name msExchMailboxGuid. >And how can I search by this? You have to rearrange the GUID. There are a couple of line wraps in the code below, but try this (replace the "DOMAIN" and "COM" with your own domain components in the 1st line of the function): ############################################################# # take a msExchMailboxGuid value and returns a value usable # in powershell # this assumes that the mailbox is attached to a user object # in the AD! function get-dn ($GUID) { $root = [ADSI]'LDAP://dc=DOMAIN,dc=COM' $searcher = New-Object System.DirectoryServices.DirectorySearcher($root) $searcher.filter = "(&(objectclass=user)(msExchMailboxGuid=$GUID))" $user = $searcher.findall() if ($user.count -gt 1) # only if the GUID matches more than # one mailbox -- that'd be weird! { $count = 0 foreach($i in $user) { Write-Host "$count`: $($i.path)" $count++ } $selection = Read-Host "Please select item: " return $user[$selection].path } else { return $user[0].path } } # begin script # just ignore errors $SavedEA=$Global:ErrorActionPreference $Global:ErrorActionPreference="SilentlyContinue" $RawGuid = Read-Host "Enter the mailbox GUID: " $RawGuid = $RawGUID -replace "-","" # remove any hyphens $RawGuid = $RawGuid.Substring(0,32) # just use the 1st 32 characters $RearrangedGUID = '' # arrange the parts of the GUID correctly $RearrangedGUID = $RawGuid.substring(6,2) + $RawGuid.substring(4,2) + $RawGuid.substring(2,2) + $RawGuid.substring(0,2) $RearrangedGUID += $RawGuid.substring(10,2) + $RawGuid.substring(8,2) $RearrangedGUID += $RawGuid.substring(14,2) + $RawGuid.substring(12,2) $RearrangedGUID += $RawGuid.substring(16,4) $RearrangedGUID += $RawGuid.substring(20,12) $EscapedGUID = '' # this will hold the \xx\xx\xx\... format needed for the search for ($i = $RearrangedGUID.length-32; $i -le 30; $i+=2) { $EscapedGUID = $EscapedGUID + ($RearrangedGUID.substring($i,2)) + "\" } $EscapedGUID = $EscapedGUID.trim("\") $EscapedGUID= "\" + $EscapedGUID $EscapedGUID $adspath = get-dn $EscapedGUID $adspath $Global:ErrorActionPreference=$SavedEA ########################################################## >For instance, if a mailbox has a identifier of MBX1, how could I pull up info about it, Get-mailbox -? Applies to Exchange 2007 SP2. If "MBX1" is the identifier, then use that. If you have the msExchMailboxGuid and want to find the user that owns the mailbox use the script (or follow the KB article that tells you how to use that value to find the user -- I think the script is easier and faster). --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
Free Windows Admin Tool Kit Click here and download it now
February 15th, 2011 3:20pm

On Tue, 15 Feb 2011 19:56:12 +0000, Smith1974 wrote: >I know AD accounts have SID's to uniquely identify them, does anyone know what the corresponding value for an Exchange mailbox is? And how can I search by this? For instance, if a mailbox has a identifier of MBX1, how could I pull up info about it, Get-mailbox -? Applies to Exchange 2007 SP2. You can also just use the "get-mailbox -id <msExchMailboxGuid>" instead of the script since it handles the GUID correctly without the hassle of rearranging everything. (get-mailbox MBX1).exchangeguid will return the msExchMailboxGuid. --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
February 15th, 2011 3:51pm

>You can also just use the "get-mailbox -id <msExchMailboxGuid>" >instead of the script since it handles the GUID correctly without the >hassle of rearranging everything. >(get-mailbox MBX1).exchangeguid will return the msExchMailboxGuid. To confirm, if the GUID is 1234, then running get-mailbox -id "1234" will return the mailbox?
Free Windows Admin Tool Kit Click here and download it now
February 15th, 2011 3:58pm

On Tue, 15 Feb 2011 20:50:31 +0000, Smith1974 wrote: >>You can also just use the "get-mailbox -id <msExchMailboxGuid>" >>instead of the script since it handles the GUID correctly without the >>hassle of rearranging everything. >>(get-mailbox MBX1).exchangeguid will return the msExchMailboxGuid. >To confirm, if the GUID is 1234, then running get-mailbox -id "1234" will return the mailbox? Yep, but the value'a a bit longer and looks like this: abdf61de-b256-4c4b-8268-172685dca75d --- Rich Matheisen MCSE+I, Exchange MVP --- Rich Matheisen MCSE+I, Exchange MVP
February 15th, 2011 5:37pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics