exchange 2013 failure to work after 2010 coexistance setup. Script to look for deleted well known objects atributes

I had completed 24 hours before, A nice 2010 federation with office 365 and Exchange. Now studying for my Lync 2013 MCSE, I  decide my current Lync 2013 needs to be on Exchange 2013 on prem. The story begins.

LOng story short, My issues end up being that apparently, I somehow end up with split permissions on the Exchange 2013 install. I tried every thing I knew how ans still could not get the new exchange install to work. The roles somehow broke or didn’t get applied. i had duplicate exchange groups and exchange 2010 was minced in so i didn’t know what was what. I decide to just blow the whole thing up and start with a nice new exchange install. I removed the Exchange objects, and ADUC system objects, wipe the boxes, delete accounts, remove and cleaned ADSI out. Now the new Exchange 2013 box wont install.

Never fear, I removed the application in every way possible and still missed something: well known group members objects.

Thank you for this article- It helped me get the missing references to well known objects removed. They were preventing the install from moving forward.

Heads up, it is still working work Exchange 2013-

# Get Microsoft Exchange Container
$objDE = New-Object System.DirectoryServices.DirectoryEntry
$ExchangeDN = [string]::Concat(“LDAP://CN=Microsoft Exchange,CN=Services,CN=Configuration,”, $objDE.distinguishedName)
$objCN = New-Object System.DirectoryServices.DirectoryEntry($ExchangeDN)

$gp = [Reflection.Bindingflags]::GetProperty

# get otherWellKnownObjects Collection
$objCol = $objCN.otherWellKnownObjects
$delCount = 0

# Walk though the Collection backwards (always do that when deleting items)
for ($i=$objCol.Count-1; $i -ge 0; $i–)
$objWKO = $objCol[$i]
$objType = $objWKO.GetType()
# Get the distinguishedName
$DNString = $objType.InvokeMember(“DNString”, $gp, $null, $objWKO, $null)

$BV = $objType.InvokeMember(“BinaryValue”, $gp, $null, $objWKO, $null)
$Guid = [GUID][System.BitConverter]::ToString($BV).Replace(“-“, “”)

Write-Host “DNString: $DNString”
Write-Host “Guid: $Guid”

# Check if the item was deleted
if ($DNString.Contains(“0ADEL”))
Write-Host “This is a Deleted Item” -foregroundcolor Red
# Remove the item (WARNING: No Confirmation asked)
Write-Host “Object Removed” -foregroundcolor Red

# Did we delete something?
if ($DelCount -gt 0)
Write-Host “Commiting Changes” -foregroundcolor Blue
# Commit changes, remove this line if you just want to test
# If you don’t commit you will not delete anything

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s