[Work Item] HealthChecker + HybridAgent
#2.005 aberto em 16 de fev. de 2024
Description
Describe the work Trying to add functionality to check for Hybrid Agent usage in Exchange Hybrid scenario.
Additional Context So far it seems we have a few ways to check this: (Credit to Dylan Stetts) $Servers = Get-ExchangeServer | ? {$_.ServerRole -notlike "Edge"} $array = @() foreach($server in $servers) { # Installed Programs location $UninstallKey=”SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall”
# Create an instance of the Registry Object and open the HKLM
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey(‘LocalMachine’,$server.name)
# Open subkeys for uninstalled programs
$regkey=$reg.OpenSubKey($UninstallKey)
# Retrieve an array of string that contain all the subkey names
$subkeys=$regkey.GetSubKeyNames()
# Open each Subkey and use GetValue Method & map server name & Key name
foreach($key in $subkeys){
$thisKey=$UninstallKey+”\\”+$key
$thisSubKey=$reg.OpenSubKey($thisKey)
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name “ExchangeServer” -Value $server.Name
$obj | Add-Member -MemberType NoteProperty -Name “DisplayName” -Value $($thisSubKey.GetValue(“DisplayName”))
$array += $obj
}
}
$array | ? { $_.DisplayName -like "Hybrid Service"} | select ExchangeServer, DisplayName
According to our documentation we can also check this file path where the HybridAgent has been installed: *\Program Files\Microsoft Hybrid Service* https://learn.microsoft.com/en-us/exchange/hybrid-deployment/hybrid-agent#option-2-get-status-via-the-hybrid-management-powershell-module