Skip to content

Commit

Permalink
Add Latest Install Time to Health Checker
Browse files Browse the repository at this point in the history
  • Loading branch information
dpaulson45 committed Aug 6, 2024
1 parent 8ea1d3b commit cfdb3ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ function Invoke-AnalyzerExchangeInformation {
}
Add-AnalyzedResultInformation @params

if ($null -ne $exchangeInformation.BuildInformation.ExchangeSetup.InstallTime) {
$params = $baseParams + @{
Name = "Latest Install Time (SU/CU)"
Details = $exchangeInformation.BuildInformation.ExchangeSetup.InstallTime
}
Add-AnalyzedResultInformation @params
}

if ($exchangeInformation.BuildInformation.VersionInformation.Supported -eq $false) {
$daysOld = ($date - $exchangeInformation.BuildInformation.VersionInformation.ReleaseDate).Days

Expand Down
10 changes: 8 additions & 2 deletions Shared/Get-ExSetupFileVersionInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,20 @@ function Get-ExSetupFileVersionInfo {
$exSetupDetails = [string]::Empty
function Get-ExSetupDetailsScriptBlock {
try {
Get-Command ExSetup -ErrorAction Stop | ForEach-Object { $_.FileVersionInfo }
$getCommand = Get-Command ExSetup -ErrorAction Stop | ForEach-Object { $_.FileVersionInfo }
$getItem = Get-Item -ErrorAction SilentlyContinue $getCommand[0].FileName
$getCommand | Add-Member -MemberType NoteProperty -Name InstallTime -Value ($getItem.LastAccessTime)
$getCommand
} catch {
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 }
$getCommand = Get-Command ([System.IO.Path]::Combine($installDirectory, "bin\ExSetup.exe")) -ErrorAction Stop | ForEach-Object { $_.FileVersionInfo }
$getItem = Get-Item -ErrorAction SilentlyContinue $getCommand[0].FileName
$getCommand | Add-Member -MemberType NoteProperty -Name InstallTime -Value ($getItem.LastAccessTime)
$getCommand
}
} catch {
Write-Verbose "Failed to find ExSetup, need to fallback."
Expand Down

0 comments on commit cfdb3ac

Please sign in to comment.