diff --git a/Setup/SetupAssist/Checks/Domain/Test-ValidHomeMdb.ps1 b/Setup/SetupAssist/Checks/Domain/Test-ValidHomeMdb.ps1 deleted file mode 100644 index fe601ec2a7..0000000000 --- a/Setup/SetupAssist/Checks/Domain/Test-ValidHomeMdb.ps1 +++ /dev/null @@ -1,42 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -. $PSScriptRoot\..\New-TestResult.ps1 -. $PSScriptRoot\..\..\..\..\Shared\ActiveDirectoryFunctions\Search-AllActiveDirectoryDomains.ps1 - -function Test-ValidHomeMDB { - $testName = "Valid Home MDB" - $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") - - $results = Search-AllActiveDirectoryDomains -Filter $filter -PropertiesToLoad $propsToLoad - - if ($null -ne $results -and - $results.Count -gt 0) { - - foreach ($result in $results) { - $dbName = $result.Properties["homeMDB"] - $params = @{ - TestName = $testName - Details = ("Mailbox DN: $($result.Properties["distinguishedName"])`n" + - "Database DN: $dbName") - ReferenceInfo = ("Run the following command in EMS.`n" + - "If EMS is down, launch PowerShell and run `"Add-PSSnapin *Exchange*`"`n" + - " Set-Mailbox 'DN' -Database 'DB_Name'") - } - - if ((-not([string]::IsNullOrEmpty($dbName))) -and - ([ADSI]::Exists("LDAP://$dbName"))) { - 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" - } -} diff --git a/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 b/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 new file mode 100644 index 0000000000..08b05aa232 --- /dev/null +++ b/Setup/SetupAssist/Checks/Domain/Test-ValidMailboxProperties.ps1 @@ -0,0 +1,63 @@ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. + +. $PSScriptRoot\..\New-TestResult.ps1 +. $PSScriptRoot\..\..\..\..\Shared\ActiveDirectoryFunctions\Search-AllActiveDirectoryDomains.ps1 + +function Test-ValidMailboxProperties { + $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", "msExchHomeServerName") + + $results = Search-AllActiveDirectoryDomains -Filter $filter -PropertiesToLoad $propsToLoad + + if ($null -ne $results -and + $results.Count -gt 0) { + + foreach ($result in $results) { + $dbName = $result.Properties["homeMDB"] + $mailboxDN = $result.Properties["distinguishedName"] + $params = @{ + 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" + + " Set-Mailbox 'DN' -Database 'DB_Name'") + } + + if ((-not([string]::IsNullOrEmpty($dbName))) -and + ([ADSI]::Exists("LDAP://$dbName"))) { + New-TestResult @params -Result "Passed" + } 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 { + $params = @{ + Result = "Failed" + Details = "Failed to find any critical mailboxes" + } + New-TestResult @params -TestName $validHomeMdbTestName + New-TestResult @params -TestName $validHomeServerTestName + } +} 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) {