Skip to content

Commit

Permalink
Merge pull request #1804 from microsoft/dpaul-HcDev
Browse files Browse the repository at this point in the history
Allow Get-EventLogLevel to force reconnect with loop
  • Loading branch information
dpaulson45 committed Aug 10, 2023
2 parents ab6be0c + 026ce5c commit 2611383
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Shared/Confirm-ExchangeShell.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ function Confirm-ExchangeShell {

try {
$currentErrors = $Error.Count
$eventLogLevel = Get-EventLogLevel -ErrorAction Stop | Select-Object -First 1
$attempts = 0
do {
$eventLogLevel = Get-EventLogLevel -ErrorAction Stop | Select-Object -First 1
$attempts++
if ($attempts -ge 5) {
throw "Failed to run Get-EventLogLevel too many times."
}
} while ($null -eq $eventLogLevel)
$getEventLogLevelCallSuccessful = $true
foreach ($e in $eventLogLevel) {
Write-Verbose "Type is: $($e.GetType().Name) BaseType is: $($e.GetType().BaseType)"
Expand Down

0 comments on commit 2611383

Please sign in to comment.