-
Notifications
You must be signed in to change notification settings - Fork 346
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #593 from microsoft/main
Release 5-19
- Loading branch information
Showing
22 changed files
with
773 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
function Load-Module { | ||
[CmdletBinding()] | ||
[OutputType([bool])] | ||
param ( | ||
[Parameter(Mandatory = $true)] | ||
[string] | ||
$Name, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string] | ||
$MinimumVersion | ||
) | ||
|
||
$moduleAlreadyLoaded = Get-Module -Name $Name | ||
if ($null -ne $moduleAlreadyLoaded) { | ||
if ([string]::IsNullOrEmpty($MinimumVersion) -or $moduleAlreadyLoaded.Version -ge $MinimumVersion) { | ||
return $true | ||
} else { | ||
Remove-Module -Name $Name | ||
} | ||
} | ||
|
||
$modulesOnDisk = @(Get-Module -Name $Name -ListAvailable | Sort-Object Version -Descending) | ||
$moduleToLoad = $null | ||
foreach ($module in $modulesOnDisk) { | ||
if ([string]::IsNullOrEmpty($MinimumVersion) -or $module.Version -ge $MinimumVersion) { | ||
$moduleToLoad = $module | ||
break | ||
} | ||
} | ||
|
||
if ($null -ne $moduleToLoad) { | ||
Import-Module $moduleToLoad | ||
return $true | ||
} | ||
|
||
$params = @{ | ||
Name = $Name | ||
} | ||
|
||
if (-not [string]::IsNullOrEmpty($MinimumVersion)) { | ||
$params.MinimumVersion = $MinimumVersion | ||
} | ||
|
||
$errorCount = $Error.Count | ||
Install-Module @params -Force | ||
if ($Error.Count -gt $errorCount) { | ||
return $false | ||
} | ||
|
||
return $true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
*.log | ||
*.log | ||
*.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
Search/Troubleshoot-ModernSearch/StoreQuery/Get-IndexingErrorMessage.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Function Get-IndexingErrorMessage { | ||
[CmdletBinding()] | ||
param( | ||
[object]$Message | ||
) | ||
begin { | ||
$condensedErrorMessage = [string]::Empty | ||
} | ||
process { | ||
|
||
if ($Message.MessageStatus -eq "Indexed") { | ||
return | ||
} | ||
|
||
if (([string]::IsNullOrWhiteSpace($Message.IndexingErrorMessage)) -or | ||
$Message.IndexingErrorMessage -eq "NULL") { | ||
|
||
if (-not ([string]::IsNullOrWhiteSpace($Message.ErrorTags))) { | ||
$condensedErrorMessage = $Message.ErrorTags | ||
} else { | ||
$condensedErrorMessage = "--Unknown--" | ||
} | ||
} elseif ($Message.IndexingErrorMessage -like "*Error parsing document exchange://localhost/Attachment*") { | ||
$errorCode = $Message.IndexingErrorMessage.Substring(0, $Message.IndexingErrorMessage.IndexOf("Error parsing")).Trim() | ||
$condensedErrorMessage = "Error parsing document: $errorCode" | ||
} else { | ||
$condensedErrorMessage = $Message.IndexingErrorMessage | ||
} | ||
} | ||
end { | ||
return $condensedErrorMessage | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.