microsoft/CSS-Exchange

[Work Item] HealthChecker + HybridAgent

Open

#2,005 创建于 2024年2月16日

在 GitHub 查看
 (2 评论) (0 反应) (1 负责人)PowerShell (985 star) (234 fork)batch import
Health CheckerP2TriageWork Itemhelp wanted

描述

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

贡献者指南