2,326 views +0 -0

Fix GFI RMM Winagent Proxy

Oneliner:

powershell -Command "$MachineRegKeyPath = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings'; $UserRegKeyPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings'; $ProxyEnableValue = 1; $ProxyServerValue = 'proxy.ezorg.nl:8080'; $ProxyOverrideValue = '<local>;*.ehsnet.nl;*.ehealthservices.nl;172.*.*.*;*.pifarma.nl'; Set-ItemProperty -Path $MachineRegKeyPath -Name ProxyEnable -Value $ProxyEnableValue -ErrorAction SilentlyContinue; Set-ItemProperty -Path $MachineRegKeyPath -Name ProxyServer -Value $ProxyServerValue -ErrorAction SilentlyContinue; Set-ItemProperty -Path $MachineRegKeyPath -Name ProxyOverride -Value $ProxyOverrideValue -ErrorAction SilentlyContinue; Set-ItemProperty -Path $UserRegKeyPath -Name ProxyEnable -Value $ProxyEnableValue -ErrorAction SilentlyContinue; Set-ItemProperty -Path $UserRegKeyPath -Name ProxyServer -Value $ProxyServerValue -ErrorAction SilentlyContinue; Set-ItemProperty -Path $UserRegKeyPath -Name ProxyOverride -Value $ProxyOverrideValue -ErrorAction SilentlyContinue; netsh winhttp import proxy ie | Out-Null; Write-Host 'System proxy settings configured successfully!' -ForegroundColor Green; Stop-Service 'Advanced Monitoring Agent' -Force -ErrorAction SilentlyContinue; if ($?) { Write-Host 'Service stopped successfully!' -ForegroundColor Green } else { Write-Host 'Service was not running' -ForegroundColor Yellow }; Stop-Process -Name winagent,*new*winagent -Force -ErrorAction SilentlyContinue; Write-Host 'Agent processes terminated' -ForegroundColor Green; Remove-Item 'C:\Program Files (x86)\Advanced Monitoring Agent\staging\*' -Recurse -Force -ErrorAction SilentlyContinue; Write-Host 'Staging folder cleaned' -ForegroundColor Green; if (-not (Select-String -Path 'C:\Program Files (x86)\Advanced Monitoring Agent\settings.ini' -Pattern 'HOST=proxy.ezorg.nl' -Quiet)) { Add-Content -Path 'C:\Program Files (x86)\Advanced Monitoring Agent\settings.ini' -Value \"[PROXYSERVER]`r`nENABLED=1`r`nHOST=proxy.ezorg.nl`r`nPORT=8080`r`nUSERNAME=`r`nUSERKEY=`r`nCACHEPATH=`r`nUPSTREAMIPADDRESS=`r`nUPSTREAMPORT=0`r`nUPSTREAMUSERNAME=`r`nUPSTREAMPASSWORD=`r`nOPENWINDOWSFIREWALL=0`r`nVERBOSELOGGING=0`r`nFAILING=0\"; Write-Host 'Proxy settings added to Agent configuration' -ForegroundColor Green }; Set-Service 'Advanced Monitoring Agent' -StartupType Automatic; Start-Service 'Advanced Monitoring Agent'; if ($?) { Write-Host 'Advanced Monitoring Agent service started successfully!' -ForegroundColor Green } else { Write-Host 'Failed to start Advanced Monitoring Agent service!' -ForegroundColor Red }"

C:\Program Files (x86)\Advanced Monitoring Agent\settings.ini
[PROXYSERVER]
ENABLED=1
HOST=proxy.ezorg.nl
PORT=8080

taskkill /f /im winagent.exe
net start "Advanced Monitoring Agent"