Hybrid Workers
Hybrid Workers often fail in combination with Azure Update Management and troubleshooting can be a nightmare. Event Manager often throws HTTPS errors or other networking errors usually sending you into the wrong direction. Below script fixes almost every error related to Hybrid Workers not responding in combination with Azure Update Management like the Azure Update Management Agent Readiness reporting as Disabled or Not Configured or “Failed to start, as hybrid worker was not available” showing up in the “Jobs” section.
Solution
- Navigate to C:\Program Files\Microsoft Monitoring Agent\Agent and run the AgentControlPanel.
Click on the second tab “Azure Log Analytics (OMS)” and remove the connection to the Workspace used by your Update Management Solution. Don’t forget to click on Apply,
Run below script on the affected machine with Administrator Privileges.
## Stop the Microsoft Monitoring Agent Service Stop-Service -name Healthservice -Force -Confirm:$false Write-Output "The Microsoft Monitoring Agent has been stopped" ## Locate and delete Health Service State folder $installationPath = Get-ItemProperty -Path Registry::"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Setup" | Select-Object -expandproperty InstallDirectory Write-Output "The installation path is $installationPath" Remove-Item -LiteralPath "$installationPath\Health Service State" -Recurse -Force -Confirm:$false Write-Output "The Health Service State folder has been deleted" ## Delete Corrupted Hybrid Worker Get-ChildItem 'HKLM:\software\microsoft\hybridrunbookworker' | Remove-Item -Force -Recurse ## Start the Microsoft Monitoring Agent Service Start-Service -name Healthservice -Confirm:$false Write-Output "The Microsoft Monitoring Agent has been started"
- Run the AgentControlPanel again and click on “Azure Log Analytics (OMS)”.
- Click on Add and enter the Workspace ID and Key from your Log Analytics Workspace which is linked to your Update Management automation account. You can find the Workspace ID and Key in Azure if you open your Workspace and click on “Agents Managed”
Save and Apply
Update Agent Readiness should be “ready” within 30 minutes.
Thank you so much for this fix! This has been driving me crazy! 🙂