From 42594dd030ccb463d7ed17771dd860f0080a90db Mon Sep 17 00:00:00 2001 From: David Paulson Date: Fri, 30 Aug 2024 12:39:43 -0500 Subject: [PATCH 1/2] Rename file to valid mailbox properties --- ...{Test-ValidHomeMdb.ps1 => Test-ValidMailboxProperties.ps1} | 2 +- Setup/SetupAssist/SetupAssist.ps1 | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) rename Setup/SetupAssist/Checks/Domain/{Test-ValidHomeMdb.ps1 => Test-ValidMailboxProperties.ps1} (97%) diff --git a/Setup/SetupAssist/Checks/Domain/Test-ValidHomeMdb.ps1 b/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 similarity index 97% rename from Setup/SetupAssist/Checks/Domain/Test-ValidHomeMdb.ps1 rename to Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 index fe601ec2a7..fb66ee7e3e 100644 --- a/Setup/SetupAssist/Checks/Domain/Test-ValidHomeMdb.ps1 +++ b/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 @@ -4,7 +4,7 @@ . $PSScriptRoot\..\New-TestResult.ps1 . $PSScriptRoot\..\..\..\..\Shared\ActiveDirectoryFunctions\Search-AllActiveDirectoryDomains.ps1 -function Test-ValidHomeMDB { +function Test-ValidMailboxProperties { $testName = "Valid Home MDB" $arbitration = 0x800000 $discovery = 0x20000000 diff --git a/Setup/SetupAssist/SetupAssist.ps1 b/Setup/SetupAssist/SetupAssist.ps1 index 9bef82dcd1..70b0397f71 100644 --- a/Setup/SetupAssist/SetupAssist.ps1 +++ b/Setup/SetupAssist/SetupAssist.ps1 @@ -16,7 +16,7 @@ param( . $PSScriptRoot\Checks\Domain\Test-DomainMultiActiveSyncVirtualDirectories.ps1 . $PSScriptRoot\Checks\Domain\Test-ExchangeADSetupLevel.ps1 . $PSScriptRoot\Checks\Domain\Test-DomainOtherWellKnownObjects.ps1 -. $PSScriptRoot\Checks\Domain\Test-ValidHomeMdb.ps1 +. $PSScriptRoot\Checks\Domain\Test-ValidMailboxProperties.ps1 . $PSScriptRoot\Checks\LocalServer\Test-ExecutionPolicy.ps1 . $PSScriptRoot\Checks\LocalServer\Test-ExchangeServices.ps1 . $PSScriptRoot\Checks\LocalServer\Test-InstallWatermark.ps1 @@ -56,7 +56,7 @@ function RunAllTests { "Test-PrerequisiteInstalled", "Test-DomainOtherWellKnownObjects", "Test-PendingReboot", - "Test-ValidHomeMDB", + "Test-ValidMailboxProperties", "Test-VirtualDirectoryConfiguration") foreach ($test in $tests) { From afa349e024fc64b07de943959b064a2d78c9861e Mon Sep 17 00:00:00 2001 From: David Paulson Date: Fri, 30 Aug 2024 14:20:33 -0500 Subject: [PATCH 2/2] Add msExchHomeServerName check for the critical mailboxes --- .../Domain/Test-ValidMailboxProperties.ps1 | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 b/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 index fb66ee7e3e..08b05aa232 100644 --- a/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 +++ b/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 @@ -5,13 +5,14 @@ . $PSScriptRoot\..\..\..\..\Shared\ActiveDirectoryFunctions\Search-AllActiveDirectoryDomains.ps1 function Test-ValidMailboxProperties { - $testName = "Valid Home MDB" + $validHomeMdbTestName = "Valid Home MDB" # Need to make sure the property value homeMDB is not null and points to a valid database object. + $validHomeServerTestName = "Valid Home Server Name" # Need to make sure the property value msExchHomeServerName is not null. $arbitration = 0x800000 $discovery = 0x20000000 $publicFolder = 0x1000000000 $recipientTypes = $arbitration -bor $discovery -bor $publicFolder $filter = "(&(objectClass=user)(mailNickname=*)(msExchRecipientTypeDetails:1.2.840.113556.1.4.804:=$recipientTypes))" - $propsToLoad = @("distinguishedName", "homeMDB") + $propsToLoad = @("distinguishedName", "homeMDB", "msExchHomeServerName") $results = Search-AllActiveDirectoryDomains -Filter $filter -PropertiesToLoad $propsToLoad @@ -20,9 +21,10 @@ function Test-ValidMailboxProperties { foreach ($result in $results) { $dbName = $result.Properties["homeMDB"] + $mailboxDN = $result.Properties["distinguishedName"] $params = @{ - TestName = $testName - Details = ("Mailbox DN: $($result.Properties["distinguishedName"])`n" + + TestName = $validHomeMdbTestName + Details = ("Mailbox DN: $mailboxDN`n" + "Database DN: $dbName") ReferenceInfo = ("Run the following command in EMS.`n" + "If EMS is down, launch PowerShell and run `"Add-PSSnapin *Exchange*`"`n" + @@ -35,8 +37,27 @@ function Test-ValidMailboxProperties { } else { New-TestResult @params -Result "Failed" } + + $homeServer = $result.Properties["msExchHomeServerName"] + $params = @{ + TestName = $validHomeServerTestName + Details = ("Mailbox DN: $mailboxDN`nHome Server Name: $homeServer") + ReferenceInfo = ("Run the following command in PowerShell or EMS.`n" + + "Set-ADObject 'DN' -Add @{msExchHomeServerName='AnExchangeServer-ExchangeLegacyDN-Value'}") + } + + if ((-not([string]::IsNullOrEmpty($homeServer)))) { + New-TestResult @params -Result "Passed" + } else { + New-TestResult @params -Result "Failed" + } } } else { - New-TestResult -TestName $testName -Result "Failed" -Details "Failed to find any critical mailboxes" + $params = @{ + Result = "Failed" + Details = "Failed to find any critical mailboxes" + } + New-TestResult @params -TestName $validHomeMdbTestName + New-TestResult @params -TestName $validHomeServerTestName } }