### Created using ChatGPT# Check if Zabbix agent is already installedif(Get-WmiObject-ClassWin32_Product|Where-Object{$_.Name-eq"Zabbix Agent (64-bit)"}){Write-Output"Zabbix Agent is already installed. Exiting..."Exit}$sharedFolderPath="\\server\share\zabbix_agent.msi"$zabbixServerIP="ZABBIX_SERVER_IP"$destinationFolder="$env:TEMP\ZabbixAgent"$hostname=$env:COMPUTERNAME$logFilePath="C:\ZabbixAgentInstallation_$(Get-Date-Format'yyyyMMdd_HHmmss').log"# Start transcript to log actionsStart-Transcript-Path$logFilePath-ForceNew-Item-ItemTypeDirectory-Path$destinationFolder-Force|Out-NullCopy-Item-Path$sharedFolderPath-Destination$destinationFolder-Force$msiArguments="/qn /i `"$destinationFolder\zabbix_agent.msi`" SERVER=$zabbixServerIP HOSTNAME=$hostname"Start-Process-FilePathmsiexec.exe-ArgumentList$msiArguments-WaitRemove-Item-Path$destinationFolder-Recurse-Force# Stop transcriptStop-Transcript
Create GPO and set it as startup script in Computer policy.
link GPO to required OU.
Author
Ahmed Bayoumy
Security Consultant, Experienced System/Network Administrator, Windows & Linux