Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Work Item] HealthChecker + HybridAgent #2005

Open
johage opened this issue Feb 16, 2024 · 2 comments
Open

[Work Item] HealthChecker + HybridAgent #2005

johage opened this issue Feb 16, 2024 · 2 comments
Labels
Work Item Work Item for project work

Comments

@johage
Copy link
Contributor

johage commented Feb 16, 2024

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

@johage johage added the Work Item Work Item for project work label Feb 16, 2024
@bill-long
Copy link
Member

It might be easier to run Get-Service to find any Exchange Servers running the Hybrid Agent.

However, apparently it is common to install the Hybrid Agent on something that is not an Exchange Server. In that scenario, there's no realistic way to detect Hybrid Agent without reaching out to Azure with global admin creds.

@johage
Copy link
Contributor Author

johage commented Feb 19, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Work Item Work Item for project work
Projects
None yet
Development

No branches or pull requests

2 participants