Exchange Issue : MESO container objects :PowerShell Came to rescue

Hi folks! I am back after a period of inactivity :)

 

Recently I worked on a scenario , where we had to restore the MESO objects and have the PF link back to the associated MESO object. We found that the Hierarchy was moved from One Admin Group to another Group after the MESO objects were removed. We had to restore the MESO Object from the AD backup : so, we needed an Auth Restore.

 

After the Auth Restore we found that the Homemdb object was pointing towards the OLD TLH. We tried to use ADMODIFY.net , a wonderful tool which has helped us a lot in the past, but unfortunately it does not work for PF L

 

Of course, we could have moved back the Hierarchy to the OLD location and probably we could have fixed the Problem. But how about using Powershell to do the magic for us?

So can the Exchange Powershell cmdlets do this magic ? Unfortunately No. So we had to use the AD Module, and it did come to our rescue beautifully.

 

To List the Proxyaddresses,ShowinAddressbook and MsexchHideFromAddresslist of the PF Objects we ran the command

Get-ADObject -LDAPFilter "(objectClass=publicFolder)" -properties showInAddressBook,proxyAddresses,msExchHideFromAddressList

We did get the Report of the Public Folders and this also showed a lot of PF's Missing the Showinaddressbook attribute.

 

So we had two tasks :

#1 set the homemdb to point to the new TLH.

#2 set the ShowInaddressbook attribute.

 

For #1 : We copied the DN value of the TLH and ran the following command

Get-ADObject -LDAPFilter "(objectClass=publicFolder)" | Set-ADObject -add @{homemdb=<DN of the TLH which was copied earlier>}

For #2 : This one was little bit tricky as we had a Multi valued property and we had two values - the DN of the Default GAL and the DN of the Public Folders Address List. So we used the array concept and ran the below commands to achieve the result

$addr = @()
$addr += "DN of the GAL"
$addr += "DN of PF List"

Get-ADObject -LDAPFilter "(objectClass=publicFolder)" | Set-ADObject -replace@{showInAddressBook = $addr}

One thing to note here is that , in #1 we had used “-add” as we needed the new entry ; and in #2 we had used “-replace” as we had to modify.

 

Until next time, have fun with powershell :)

 A very Special Thanks To Senthil Kumar S SEE in the Exchange Team for his Ideas on this.