diff --git a/Windows/ZabbixAgent/README.md b/Windows/ZabbixAgent/README.md index d2b11238c5120d0afd32e425935c62cd58613e32..c14563eb029da039dffcdb446c8273b9804e635e 100644 --- a/Windows/ZabbixAgent/README.md +++ b/Windows/ZabbixAgent/README.md @@ -30,7 +30,8 @@ This one-liner download and install does the following: To download, save, and execute the script, you need to temporarily change the PowerShell execution policy to allow script execution. You can do all this by using the following one-liner code in an elevated PowerShell session: ```powershell -Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; Stop-Service -Name "Zabbix Agent 2"; $scriptPath = "C:\Windows\System32\Tasks\CheckAndStartZabbixAgent2.ps1"; Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/ZabbixAgent/CheckAndStartZabbixAgent2.ps1" -OutFile $scriptPath; schtasks /create /tn "CheckAndStartZabbixAgent2" /tr "powershell.exe -File $scriptPath" /sc hourly /mo 3 /ru SYSTEM; schtasks /run /tn "CheckAndStartZabbixAgent2"; +Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; Stop-Service -Name "Zabbix Agent 2"; $scriptPath = "C:\Windows\System32\Tasks\CheckAndStartZabbixAgent2.ps1"; try { Invoke-WebRequest -Uri "https://gitlab.liu.se/andli86/snippets/-/raw/master/Windows/ZabbixAgent/CheckAndStartZabbixAgent2.ps1" -OutFile $scriptPath -ErrorAction Stop; schtasks /create /tn "CheckAndStartZabbixAgent2" /tr "powershell.exe -File $scriptPath" /sc hourly /mo 3 /ru SYSTEM; schtasks /run /tn "CheckAndStartZabbixAgent2"; } catch { Write-Output "Failed to download the script file. Exiting prematurely."; Start-Service -Name "Zabbix Agent 2"; exit 1; } + ``` ### Manual Installation