Skip to content
Snippets Groups Projects
Commit 5934c65b authored by Andreas Lindemark's avatar Andreas Lindemark
Browse files

Added a Stop-Service in the ine-liner setup, to first stop the Zabbix Agent 2 service.

parent bde722b9
No related branches found
No related tags found
No related merge requests found
......@@ -20,14 +20,16 @@ This repository contains scripts to
### Via an automatic One-Liner, that Downloads, installs and clean up
This one-liner download and install does the following:
1. Sets the path to store the script.
2. Download the script file to the path.
3. Create a scheduled task.
1. Sets the ExecutionPolicy
2. Stop the "Zabbix Agent 2" service.
3. Set the path where to store the script.
4. Download the script file to the path.
5. Create a scheduled task.
1. To run the script, you need to temporarily change the PowerShell execution policy to allow script execution. You can do this by using the following one-liner code:
```powershell
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass -Force; $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;
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;
```
## Manual Installation
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment