Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function New-ExchangeAuthCertificate {
#>

Write-Verbose "Calling: $($MyInvocation.MyCommand)"
$confirmationMessage = "The following actions will be performed:" +
$confirmationMessage = "The following actions will be performed without the need to reconfirm:" +
"`r`n - The internal transport certificate will be queried" +
"`r`n - A new certificate will be generated, it overrides the internal transport certificate" +
"`r`n - The internal transport certificate will be set back to the previous one" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ function Get-ExchangeAuthCertificateStatus {
ConfigureNextAuthRequired = $configureNextAuthRequired
NumberOfUnreachableServers = $exchangeServersUnreachableList.Count
UnreachableServersList = $exchangeServersUnreachableList
AuthCertificateMissingOnServers = $currentAuthCertificateMissingOnServersList
NextAuthCertificateMissingOnServers = $nextAuthCertificateMissingOnServersList
HybridSetupDetected = ($null -ne $hybridConfiguration)
StopProcessingDueToHybrid = $stopProcessingDueToHybrid
MultipleExchangeADSites = $multipleExchangeSites
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,8 @@ Describe "Testing Get-ExchangeAuthCertificateStatus.ps1" {
Mock Get-ExchangeServerCertificate {
throw [System.InvalidOperationException]::New()
} -ParameterFilter {
$Thumbprint -eq "E1BDF9AE58C93C75E76C9DD882138FB8FF0FA786"
($Thumbprint -eq "E1BDF9AE58C93C75E76C9DD882138FB8FF0FA786") -and
($Server -eq "E2k16-2.Contoso.lab")
}
$Script:results = Get-ExchangeAuthCertificateStatus
}
Expand All @@ -212,6 +213,8 @@ Describe "Testing Get-ExchangeAuthCertificateStatus.ps1" {
$results.ReplaceRequired | Should -Be $true
$results.ConfigureNextAuthRequired | Should -Be $false
$results.NumberOfUnreachableServers | Should -Be 0
$results.AuthCertificateMissingOnServers.Count | Should -Be 1
$results.AuthCertificateMissingOnServers | Should -Contain "E2k16-2.Contoso.lab"
}
}

Expand All @@ -222,7 +225,8 @@ Describe "Testing Get-ExchangeAuthCertificateStatus.ps1" {
Mock Get-ExchangeServerCertificate {
throw [System.InvalidOperationException]::New()
} -ParameterFilter {
$Thumbprint -eq "BC6BF924D6EF046E64F8D1987DC1D7D2F4C0042A"
($Thumbprint -eq "BC6BF924D6EF046E64F8D1987DC1D7D2F4C0042A") -and
($Server -eq "E2k16-1.Contoso.lab")
}
$Script:results = Get-ExchangeAuthCertificateStatus
}
Expand All @@ -233,6 +237,8 @@ Describe "Testing Get-ExchangeAuthCertificateStatus.ps1" {
$results.ReplaceRequired | Should -Be $false
$results.ConfigureNextAuthRequired | Should -Be $true
$results.NumberOfUnreachableServers | Should -Be 0
$results.NextAuthCertificateMissingOnServers.Count | Should -Be 1
$results.NextAuthCertificateMissingOnServers | Should -Contain "E2k16-1.Contoso.lab"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,22 @@ function Main {
if ($authCertStatus.NumberOfUnreachableServers -gt 0) {
Write-Host ("Number of unreachable Exchange servers: $($authCertStatus.NumberOfUnreachableServers)") -ForegroundColor Cyan
}
if ($authCertStatus.AuthCertificateMissingOnServers.Count -gt 0) {
Write-Host ("The actively used Auth Certificate is missing on the following servers:") -ForegroundColor Cyan
Write-Host ("$([string]::Join(", ", $authCertStatus.AuthCertificateMissingOnServers))") -ForegroundColor Cyan
}
if ($authCertStatus.NextAuthCertificateMissingOnServers.Count -gt 0) {
Write-Host ("The certificate which is configured as next Auth Certificate is missing on the following servers:") -ForegroundColor Cyan
Write-Host ("$([string]::Join(", ", $authCertStatus.NextAuthCertificateMissingOnServers))") -ForegroundColor Cyan
}
Write-Host ("")
Write-Host ("Test result: $($renewalActionWording)") -ForegroundColor Cyan
if (($authCertStatus.AuthCertificateMissingOnServers.Count -gt 0) -or
($authCertStatus.NextAuthCertificateMissingOnServers.Count -gt 0)) {
$certificateMissingOnServersWording = ("`r`nYou should copy the Auth Certificate to the missing servers and re-run the script." +
"`r`nA missing Auth Certificate will cause a new one to be generated by the script.")
Write-Host $certificateMissingOnServersWording -ForegroundColor Cyan
}
}

if (($renewalActionRequired) -and
Expand Down
26 changes: 13 additions & 13 deletions Diagnostics/HealthChecker/Features/Get-LoadBalancingReport.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ function Get-LoadBalancingReport {
Write-Verbose "Calling: $($MyInvocation.MyCommand)"
$CASServers = @()
$MBXServers = @()
$getExchangeServer = Get-ExchangeServer
$getExchangeServer = Get-ExchangeServer | Select-Object Name, Site, IsClientAccessServer, IsMailboxServer, AdminDisplayVersion, FQDN

if ($SiteName -ne [string]::Empty) {
Write-Grey("Site filtering ON. Only Exchange 2013+ CAS servers in {0} will be used in the report." -f $SiteName)
$CASServers = $getExchangeServer | Where-Object {
($_.IsClientAccessServer -eq $true) -and
($_.AdminDisplayVersion -Match "^Version 15") -and
([System.Convert]::ToString($_.Site).Split("/")[-1] -eq $SiteName) } | Sort-Object Name
([System.Convert]::ToString($_.Site).Split("/")[-1] -eq $SiteName) } | Select-Object Name, Site | Sort-Object Name
Write-Grey("Site filtering ON. Only Exchange 2013+ MBX servers in {0} will be used in the report." -f $SiteName)
$MBXServers = $getExchangeServer | Where-Object {
($_.IsMailboxServer -eq $true) -and
($_.AdminDisplayVersion -Match "^Version 15") -and
([System.Convert]::ToString($_.Site).Split("/")[-1] -eq $SiteName) } | Sort-Object Name
([System.Convert]::ToString($_.Site).Split("/")[-1] -eq $SiteName) } | Select-Object Name, Site | Sort-Object Name
} else {
if ( ($null -eq $ServerList) ) {
Write-Grey("Filtering OFF. All Exchange 2013+ servers will be used in the report.")
$CASServers = $getExchangeServer | Where-Object { ($_.IsClientAccessServer -eq $true) -and ($_.AdminDisplayVersion -Match "^Version 15") } | Sort-Object Name
$MBXServers = $getExchangeServer | Where-Object { ($_.IsMailboxServer -eq $true) -and ($_.AdminDisplayVersion -Match "^Version 15") } | Sort-Object Name
$CASServers = $getExchangeServer | Where-Object { ($_.IsClientAccessServer -eq $true) -and ($_.AdminDisplayVersion -Match "^Version 15") } | Select-Object Name, Site | Sort-Object Name
$MBXServers = $getExchangeServer | Where-Object { ($_.IsMailboxServer -eq $true) -and ($_.AdminDisplayVersion -Match "^Version 15") } | Select-Object Name, Site | Sort-Object Name
} else {
Write-Grey("Custom server list is being used. Only servers specified after the -ServerList parameter will be used in the report.")
$CASServers = $getExchangeServer | Where-Object { ($_.IsClientAccessServer -eq $true) -and ( ($_.Name -in $ServerList) -or ($_.FQDN -in $ServerList) ) } | Sort-Object Name
$MBXServers = $getExchangeServer | Where-Object { ($_.IsMailboxServer -eq $true) -and ( ($_.Name -in $ServerList) -or ($_.FQDN -in $ServerList) ) } | Sort-Object Name
Write-Grey("Custom server list is being used. Only servers specified after the -ServerList parameter will be used in the report.")
$CASServers = $getExchangeServer | Where-Object { ($_.IsClientAccessServer -eq $true) -and ( ($_.Name -in $ServerList) -or ($_.FQDN -in $ServerList) ) } | Select-Object Name, Site | Sort-Object Name
$MBXServers = $getExchangeServer | Where-Object { ($_.IsMailboxServer -eq $true) -and ( ($_.Name -in $ServerList) -or ($_.FQDN -in $ServerList) ) } | Select-Object Name, Site | Sort-Object Name
}
}

Expand All @@ -43,7 +43,7 @@ function Get-LoadBalancingReport {
}

foreach ($server in $ServerList) {
if ($server -notin $CASServers -and $server -notin $MBXServers) {
if ($server -notin $CASServers.Name -and $server -notin $MBXServers.Name) {
Write-Warning "$server was not found as an Exchange server."
}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ function Get-LoadBalancingReport {
$totalBackendStats = [ordered]@{}

$currentErrors = $Error.Count
foreach ( $CASServer in $CASServers) {
foreach ( $CASServer in $CASServers.Name) {
$DefaultIdSite = Invoke-Command -ComputerName $CASServer -ScriptBlock { (Get-Website "Default Web Site").Id }

$FECounters = Get-LocalizedCounterSamples -MachineName $CASServer -Counter @(
Expand Down Expand Up @@ -141,7 +141,7 @@ function Get-LoadBalancingReport {

$keyOrders = $displayKeys.Keys | Sort-Object

foreach ( $MBXServer in $MBXServers) {
foreach ( $MBXServer in $MBXServers.Name) {
$BackendIdSite = Invoke-Command -ComputerName $MBXServer -ScriptBlock { (Get-Website "Exchange Back End").Id }

$BECounters = Get-LocalizedCounterSamples -MachineName $MBXServer -Counter @(
Expand Down Expand Up @@ -218,7 +218,7 @@ function Get-LoadBalancingReport {
$htmlLoadDetails += "$([System.Environment]::NewLine)</tr>$([System.Environment]::NewLine)"

foreach ($server in $CASServers) {
$serverKey = $server.Name.ToString()
$serverKey = $server.Name
Write-Verbose "Working Server for HTML report $serverKey"
$htmlLoadDetails += "<tr>
<td>$($serverKey)</td>
Expand Down Expand Up @@ -285,7 +285,7 @@ function Get-LoadBalancingReport {
$htmlLoadDetailsBackend += "$([System.Environment]::NewLine)</tr>$([System.Environment]::NewLine)"

foreach ($server in $MBXServers) {
$serverKey = $server.Name.ToString()
$serverKey = $server.Name
Write-Verbose "Working Server for HTML report $serverKey"
$htmlLoadDetailsBackend += "<tr>
<td>$($serverKey)</td>
Expand Down