Skip to content

Commit

Permalink
Do a manual lookup for ExSetup.exe as well
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulson45 committed Feb 7, 2024
1 parent 82e3b68 commit 50bb2a3
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@ function Get-ExSetupDetails {
try {
Get-Command ExSetup -ErrorAction Stop | ForEach-Object { $_.FileVersionInfo }
} catch {
Write-Verbose "Failed to find ExSetup, need to fallback."
try {
Write-Verbose "Failed to find ExSetup by environment path locations. Attempting manual lookup."
$installDirectory = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup -ErrorAction Stop).MsiInstallPath

if ($null -ne $installDirectory) {
Get-Command ([System.IO.Path]::Combine($installDirectory, "bin\ExSetup.exe")) -ErrorAction Stop | ForEach-Object { $_.FileVersionInfo }
}
} catch {
Write-Verbose "Failed to find ExSetup, need to fallback."
}
}
}

Expand Down

0 comments on commit 50bb2a3

Please sign in to comment.