From 58adda81a871b4d7ba84a55ba9c0bec3111f7cf7 Mon Sep 17 00:00:00 2001 From: DistractADD Date: Thu, 10 Sep 2026 16:56:34 +1000 Subject: [PATCH] Update Deploy-ZabbixAgent2.ps1 Update zabbix service restart --- Deploy-ZabbixAgent2.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Deploy-ZabbixAgent2.ps1 b/Deploy-ZabbixAgent2.ps1 index 7261f51..050782a 100644 --- a/Deploy-ZabbixAgent2.ps1 +++ b/Deploy-ZabbixAgent2.ps1 @@ -167,7 +167,14 @@ if (-not $existingService) { Remove-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Services\EventLog\Application\Zabbix Agent 2" -Recurse -Force -ErrorAction SilentlyContinue & $ExePath --config "$ConfPath" --install Start-Sleep -Seconds 2 + Start-Service "Zabbix Agent 2" } +else { + # Force a restart so any newly written config or metadata loads into RAM immediately + Restart-Service "Zabbix Agent 2" -Force +} + +Set-Service -Name "Zabbix Agent 2" -StartupType Automatic Start-Service "Zabbix Agent 2" -ErrorAction SilentlyContinue Set-Service -Name "Zabbix Agent 2" -StartupType Automatic