Skip to content

Commit

Permalink
Merge pull request #576 from microsoft/main
Browse files Browse the repository at this point in the history
Release 5-5-21
  • Loading branch information
dpaulson45 authored May 5, 2021
2 parents bcf8ec1 + 5c37d60 commit 82e4297
Show file tree
Hide file tree
Showing 19 changed files with 255 additions and 81 deletions.
22 changes: 21 additions & 1 deletion .build/CodeFormatter.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,28 @@ $scriptFiles = Get-ChildItem -Path $repoRoot -Directory | Where-Object {
$_.Name -ne "dist" } | ForEach-Object { Get-ChildItem -Path $_.FullName -Include "*.ps1", "*.psm1" -Recurse } | ForEach-Object { $_.FullName }
$filesFailed = $false

foreach ($file in $scriptFiles) {
# MD files must NOT have a BOM
Get-ChildItem -Path $repoRoot -Include *.md -Recurse | ForEach-Object {
$encoding = Get-Encoding $_
if ($encoding.BOM) {
Write-Warning "MD file has BOM: $($_.FullName)"
if ($Save) {
try {
$content = Get-Content $_
Set-Content -Path $_.FullName -Value $content -Encoding utf8NoBOM -Force
Write-Warning "Saved $($_.FullName) without BOM."
} catch {
$filesFailed = $true
throw
}
} else {
$filesFailed = $true
}
}
}

foreach ($file in $scriptFiles) {
# PS1 files must have a BOM
$encoding = Get-Encoding $file
if (-not $encoding.BOM) {
Write-Warning "File has no BOM: $file"
Expand Down
6 changes: 0 additions & 6 deletions .github/ISSUE_TEMPLATE/check-setting-or-config-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ assignees: ''

---

<!--
If this is a MISSING BASELINE issue, please comment in #313 rather than opening a new issue.
-->

**Is your request related to a problem? Please describe.**
A clear and concise description of what the problem is and the results it had on the environment.

Expand Down
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/health-checker-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Health Checker Issue Report
about: Create a report to help us improve
title: "[Issue] - Health Checker"
labels: Issue, "Health Checker"
assignees: ''

---

**Provide Version Number**
Provide the version of the script that has the issue.

**Describe the issue**
A clear and concise description of the issue.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Script Output**
If applicable, add the exception that wasn't handled.

**Additional context**
Add any other context about the problem here.
12 changes: 3 additions & 9 deletions .github/ISSUE_TEMPLATE/issue-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,14 @@ assignees: ''

---

<!--
If this is a MISSING BASELINE issue, please comment in #313 rather than opening a new issue.
-->

**Describe the issue**
A clear and concise description of what the issue is, including what script you are seeing the error in.
Provide the version of the script that has the issue.

**Expected behavior**
A clear and concise description of what you expected to happen.
A clear and concise description of what the issue is, including the script name.

**Script Output**
If applicable, add the exception that you are seeing that wasn't handled.
If applicable, add the exception that wasn't handled.

**Additional context**
Add any other context about the problem here.
6 changes: 0 additions & 6 deletions .github/ISSUE_TEMPLATE/work-item.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ assignees: ''

---

<!--
If this is a MISSING BASELINE issue, please comment in #313 rather than opening a new issue.
-->

**Describe the work**
Provide details of the work that needs to be done within the project

Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"powershell.codeFormatting.whitespaceInsideBrace": true,
"powershell.codeFormatting.addWhitespaceAroundPipe": true,
"files.trimTrailingWhitespace": true,
"files.encoding": "utf8bom"
"files.encoding": "utf8",
"[powershell]": {
"files.encoding": "utf8bom"
}
}
56 changes: 37 additions & 19 deletions Diagnostics/HealthChecker/Analyzer/Invoke-AnalyzerEngine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -407,37 +407,51 @@
if ($null -ne $osInformation.VcRedistributable) {
Write-VerboseOutput("VCRedist2012 Testing value: {0}" -f [HealthChecker.VCRedistVersion]::VCRedist2012.value__)
Write-VerboseOutput("VCRedist2013 Testing value: {0}" -f [HealthChecker.VCRedistVersion]::VCRedist2013.value__)
$vc2013Required = $exchangeInformation.BuildInformation.ServerRole -ne [HealthChecker.ExchangeServerRole]::Edge
$displayValue2012 = "Redistributable is outdated"
$displayValue2013 = "Redistributable is outdated"

foreach ($detectedVisualRedistVersion in $osInformation.VcRedistributable) {
Write-VerboseOutput("Testing {0} version id '{1}'" -f $detectedVisualRedistVersion.DisplayName, $detectedVisualRedistVersion.VersionIdentifier)

if ($detectedVisualRedistVersion.VersionIdentifier -eq [HealthChecker.VCRedistVersion]::VCRedist2012) {
$displayValue2012 = "{0} Version is current" -f $detectedVisualRedistVersion.DisplayVersion
$displayWriteType2012 = "Green"
} elseif ($vc2013Required -and
$detectedVisualRedistVersion.VersionIdentifier -eq [HealthChecker.VCRedistVersion]::VCRedist2013) {
$displayWriteType2013 = "Green"
$displayValue2013 = "{0} Version is current" -f $detectedVisualRedistVersion.DisplayVersion
if ($detectedVisualRedistVersion.DisplayName -like "Microsoft Visual C++ 2012*") {
$vcRedist2012Detected = $true
if ($detectedVisualRedistVersion.VersionIdentifier -eq [HealthChecker.VCRedistVersion]::VCRedist2012) {
$displayWriteType2012 = "Green"
$displayValue2012 = "{0} Version is current" -f $detectedVisualRedistVersion.DisplayVersion
}
} elseif ($detectedVisualRedistVersion.DisplayName -like "Microsoft Visual C++ 2013*") {
$vcRedist2013Detected = $true
if ($detectedVisualRedistVersion.VersionIdentifier -eq [HealthChecker.VCRedistVersion]::VCRedist2013) {
$displayWriteType2013 = "Green"
$displayValue2013 = "{0} Version is current" -f $detectedVisualRedistVersion.DisplayVersion
}
}
}

if (($vcRedist2012Detected -eq $true) -and ($displayWriteType2012 -ne "Green")) {
$displayValue2012 = "Redistributable is outdated"
}

if (($vcRedist2013Detected -eq $true) -and ($displayWriteType2013 -ne "Green")) {
$displayValue2013 = "Redistributable is outdated"
}
}

$analyzedResults = Add-AnalyzedResultInformation -Name "Visual C++ 2012" -Details $displayValue2012 `
-DisplayGroupingKey $keyOSInformation `
-DisplayWriteType $displayWriteType2012 `
-AnalyzedInformation $analyzedResults

$analyzedResults = Add-AnalyzedResultInformation -Name "Visual C++ 2013" -Details $displayValue2013 `
-DisplayGroupingKey $keyOSInformation `
-DisplayWriteType $displayWriteType2013 `
-AnalyzedInformation $analyzedResults
if ($exchangeInformation.BuildInformation.ServerRole -ne [HealthChecker.ExchangeServerRole]::Edge) {
$analyzedResults = Add-AnalyzedResultInformation -Name "Visual C++ 2013" -Details $displayValue2013 `
-DisplayGroupingKey $keyOSInformation `
-DisplayWriteType $displayWriteType2013 `
-AnalyzedInformation $analyzedResults
}

if (($exchangeInformation.BuildInformation.ServerRole -ne [HealthChecker.ExchangeServerRole]::Edge -and
($displayWriteType2012 -eq "Yellow" -or
$displayWriteType2013 -eq "Yellow")) -or
$displayWriteType2012 -eq "Yellow") {

if ($null -ne $osInformation.VcRedistributable -and
($displayWriteType2012 -eq "Yellow" -or
$displayWriteType2013 -eq "Yellow")) {
$analyzedResults = Add-AnalyzedResultInformation -Details "Note: For more information about the latest C++ Redistributeable please visit: https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads`r`n`t`tThis is not a requirement to upgrade, only a notification to bring to your attention." `
-DisplayGroupingKey $keyOSInformation `
-DisplayCustomTabNumber 2 `
Expand Down Expand Up @@ -932,10 +946,14 @@
$displayValue = "True"
$testingValue = $true

if ($osInformation.NetworkInformation.IPv6DisabledComponents -ne 255) {
if ($osInformation.NetworkInformation.IPv6DisabledComponents -eq -1) {
$displayWriteType = "Red"
$testingValue = $false
$displayValue = "False `r`n`t`tError: IPv6 is disabled on some NIC level settings but not correctly disabled via DisabledComponents registry value. It is currently set to '-1'. `r`n`t`tThis setting cause a system startup delay of 5 seconds. For details please refer to: `r`n`t`thttps://docs.microsoft.com/en-US/troubleshoot/windows-server/networking/configure-ipv6-in-windows#use-registry-key-to-configure-ipv6"
} elseif ($osInformation.NetworkInformation.IPv6DisabledComponents -ne 255) {
$displayWriteType = "Red"
$testingValue = $false
$displayValue = "False `r`n`t`tError: IPv6 is disabled on some NIC level settings but not fully disabled. DisabledComponents registry key currently set to '{0}'. For details please refer to the following articles: `r`n`t`thttps://blog.rmilne.ca/2014/10/29/disabling-ipv6-and-exchange-going-all-the-way `r`n`t`thttps://support.microsoft.com/en-us/help/929852/guidance-for-configuring-ipv6-in-windows-for-advanced-users" -f $osInformation.NetworkInformation.DisabledComponents
$displayValue = "False `r`n`t`tError: IPv6 is disabled on some NIC level settings but not fully disabled. DisabledComponents registry value currently set to '{0}'. For details please refer to the following articles: `r`n`t`thttps://blog.rmilne.ca/2014/10/29/disabling-ipv6-and-exchange-going-all-the-way `r`n`t`thttps://support.microsoft.com/en-us/help/929852/guidance-for-configuring-ipv6-in-windows-for-advanced-users" -f $osInformation.NetworkInformation.IPv6DisabledComponents
}

$analyzedResults = Add-AnalyzedResultInformation -Name "Disable IPv6 Correctly" -Details $displayValue `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
$certFriendlyName = $cert.FriendlyName
}

if ([String]::IsNullOrEmpty($cert.Status)) {
$certStatus = "Unknown"
} else {
$certStatus = ($cert.Status).ToString()
}

$certInformationObj = New-Object PSCustomObject
$certInformationObj | Add-Member -MemberType NoteProperty -Name "FriendlyName" -Value $certFriendlyName
$certInformationObj | Add-Member -MemberType NoteProperty -Name "Thumbprint" -Value $cert.Thumbprint
Expand All @@ -64,7 +70,7 @@
$certInformationObj | Add-Member -MemberType NoteProperty -Name "Services" -Value $cert.Services
$certInformationObj | Add-Member -MemberType NoteProperty -Name "IsCurrentAuthConfigCertificate" -Value $isAuthConfigInfo
$certInformationObj | Add-Member -MemberType NoteProperty -Name "LifetimeInDays" -Value $certificateLifetime
$certInformationObj | Add-Member -MemberType NoteProperty -Name "Status" -Value $cert.Status
$certInformationObj | Add-Member -MemberType NoteProperty -Name "Status" -Value $certStatus
$certInformationObj | Add-Member -MemberType NoteProperty -Name "CertificateObject" -Value $cert

$certObject += $certInformationObj
Expand Down
6 changes: 6 additions & 0 deletions Diagnostics/HealthChecker/HealthChecker.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
Name of the HTML output file from the BuildHtmlServersReport. Default is ExchangeAllServersReport.html
.PARAMETER DCCoreRatio
Gathers the Exchange to DC/GC Core ratio and displays the results in the current site that the script is running in.
.PARAMETER AnalyzeDataOnly
Switch to analyze the existing HealthChecker XML files. The results are displayed on the screen and an HTML report is generated.
.PARAMETER SkipVersionCheck
No version check is performed when this switch is used.
.PARAMETER SaveDebugLog
The debug log is kept even if the script is executed successfully.
.PARAMETER Verbose
This optional parameter enables verbose logging.
.EXAMPLE
Expand Down
1 change: 1 addition & 0 deletions Search/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.log
51 changes: 23 additions & 28 deletions Search/Troubleshoot-ModernSearch.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,27 @@ param(

[Parameter(Mandatory = $true, ParameterSetName = "MailboxIndexStatistics")]
[ValidateSet("All", "Indexed", "PartiallyIndexed", "NotIndexed", "Corrupted", "Stale", "ShouldNotBeIndexed")]
[string]$Category,
[string[]]$Category,

[Parameter(Mandatory = $false, ParameterSetName = "MailboxIndexStatistics")]
[bool]$GroupMessages = $true,

[Parameter(Mandatory = $false, ParameterSetName = "MultiMailboxStatistics")]
[ValidateNotNullOrEmpty()]
[string[]]$Server,

[Parameter(Mandatory = $false, ParameterSetName = "MultiMailboxStatistics")]
[ValidateSet("TotalMailboxItems", "TotalBigFunnelSearchableItems", "TotalSearchableItems",
"BigFunnelIndexedCount", "IndexedCount", "BigFunnelNotIndexedCount", "NotIndexedCount",
"BigFunnelPartiallyIndexedCount", "PartIndexedCount", "BigFunnelCorruptedCount", "CorruptedCount",
"BigFunnelStaleCount", "StaleCount", "BigFunnelShouldNotBeIndexedCount", "ShouldNotIndexCount", "FullyIndexPercentage")]
[ValidateNotNullOrEmpty()]
[string]$SortByProperty = "FullyIndexPercentage",

[Parameter(Mandatory = $false, ParameterSetName = "MultiMailboxStatistics")]
[ValidateNotNullOrEmpty()]
[bool]$ExcludeFullyIndexedMailboxes = $true,

[ValidateNotNullOrEmpty()]
[string]
$QueryString,
Expand All @@ -49,11 +64,12 @@ param(

#Not sure why yet, but if you do -Verbose with the script, we end up in a loop somehow.
#Going to add in this hard fix for the time being to avoid issues.
$Script:VerbosePreference= "SilentlyContinue"
$Script:VerbosePreference = "SilentlyContinue"

. $PSScriptRoot\Troubleshoot-ModernSearch\Exchange\Get-MailboxInformation.ps1

. $PSScriptRoot\Troubleshoot-ModernSearch\StoreQuery\Get-BasicMailboxQueryContext.ps1
. $PSScriptRoot\Troubleshoot-ModernSearch\StoreQuery\Get-CategoryOffStatistics.ps1
. $PSScriptRoot\Troubleshoot-ModernSearch\StoreQuery\Get-FolderInformation.ps1
. $PSScriptRoot\Troubleshoot-ModernSearch\StoreQuery\Get-MessageIndexState.ps1
. $PSScriptRoot\Troubleshoot-ModernSearch\StoreQuery\Get-QueryItemResult.ps1
Expand Down Expand Up @@ -103,7 +119,7 @@ Function Main {
if ($null -ne $Server -and
$Server.Count -ge 1) {

Write-MailboxStatisticsOnServer -Server $Server
Write-MailboxStatisticsOnServer -Server $Server -SortByProperty $SortByProperty -ExcludeFullyIndexedMailboxes $ExcludeFullyIndexedMailboxes
return
}

Expand Down Expand Up @@ -132,9 +148,9 @@ Function Main {
)
Write-ScriptOutput "----------------------------------------"

if (-not([string]::IsNullOrEmpty($Category))) {
if ($Category.Count -ge 1) {

Write-MailboxIndexMessageStatistics -BasicMailboxQueryContext $basicMailboxQueryContext -MailboxStatistics $mailboxInformation.MailboxStatistics -Category $Category
Write-MailboxIndexMessageStatistics -BasicMailboxQueryContext $basicMailboxQueryContext -MailboxStatistics $mailboxInformation.MailboxStatistics -Category $Category -GroupMessages $GroupMessages
return
}

Expand Down Expand Up @@ -197,28 +213,7 @@ Function Main {
}
}

$mailboxStats = $mailboxInformation.MailboxStatistics
$categories = New-Object 'System.Collections.Generic.List[string]'

if ($mailboxStats.BigFunnelNotIndexedCount -ge 250) {
$categories.Add("NotIndexed")
}

if ($mailboxStats.BigFunnelCorruptedCount -ge 100) {
$categories.Add("Corrupted")
}

if ($mailboxStats.BigFunnelPartiallyIndexedCount -ge 1000) {
$categories.Add("PartiallyIndexed")
}

if ($mailboxStats.BigFunnelStaleCount -ge 100) {
$categories.Add("Stale")
}

if ($mailboxStats.BigFunnelShouldNotBeIndexedCount -ge 5000) {
$categories.Add("ShouldNotBeIndexed")
}
$categories = Get-CategoryOffStatistics -MailboxStatistics $mailboxInformation.MailboxStatistics

if ($categories.Count -gt 0) {
Write-ScriptOutput ""
Expand All @@ -228,7 +223,7 @@ Function Main {
$categories | Write-ScriptOutput
Write-ScriptOutput ""
Write-ScriptOutput "This may take some time to collect."
Write-MailboxIndexMessageStatistics -BasicMailboxQueryContext $basicMailboxQueryContext -MailboxStatistics $mailboxStats -Category $categories
Write-MailboxIndexMessageStatistics -BasicMailboxQueryContext $basicMailboxQueryContext -MailboxStatistics $mailboxInformation.MailboxStatistics -Category $categories -GroupMessages $GroupMessages
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
if ($_.DisplayName -notlike "SystemMailbox*" -and
$_.DisplayName -notlike "*HealthMailbox-*" -and
$_.DisconnectReason -eq $null) {

$totalMailboxItems = $_.ItemCount + $_.AssociatedItemCount + $_.DeletedItemCount
$totalBigFunnelItems = $_.BigFunnelIndexedCount + $_.BigFunnelPartiallyIndexedCount + $_.BigFunnelNotIndexedCount + `
$_.BigFunnelCorruptedCount + $_.BigFunnelStaleCount + $_.BigFunnelShouldNotBeIndexedCount
$totalBigFunnelSearchableItems = $totalBigFunnelItems - $_.BigFunnelShouldNotBeIndexedCount
$fullIndexPercentage = -1

if ($totalBigFunnelSearchableItems -ne 0) {
$fullIndexPercentage = [Math]::Round((($_.BigFunnelIndexedCount / $totalBigFunnelSearchableItems) * 100), 2)
}

$mailboxStatisticsList.Add([PSCustomObject]@{
MailboxGuid = $_.MailboxGuid.ToString()
DisplayName = $_.DisplayName
Expand All @@ -31,6 +42,10 @@
BigFunnelCorruptedCount = $_.BigFunnelCorruptedCount
BigFunnelStaleCount = $_.BigFunnelStaleCount
BigFunnelShouldNotBeIndexedCount = $_.BigFunnelShouldNotBeIndexedCount
TotalMailboxItems = $totalMailboxItems
TotalBigFunnelItems = $totalBigFunnelItems
TotalBigFunnelSearchableItems = $totalBigFunnelSearchableItems
FullyIndexPercentage = $fullIndexPercentage
})
}
}
Expand Down
Loading

0 comments on commit 82e4297

Please sign in to comment.