From 121274dca2c683738e010d270554d00253bbe68d Mon Sep 17 00:00:00 2001 From: bradhawkins85 Date: Thu, 25 Feb 2021 19:59:29 +1000 Subject: [PATCH] Update installer.ps1 Don't try and add Windows Defender exceptions if Defender is not enabled, prevents errors during script execution. --- api/tacticalrmm/core/installer.ps1 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/api/tacticalrmm/core/installer.ps1 b/api/tacticalrmm/core/installer.ps1 index 76903cac..699f0d8c 100644 --- a/api/tacticalrmm/core/installer.ps1 +++ b/api/tacticalrmm/core/installer.ps1 @@ -33,11 +33,13 @@ If (Get-Service $serviceName -ErrorAction SilentlyContinue) { Try { - Add-MpPreference -ExclusionPath 'C:\Program Files\TacticalAgent\*' - Add-MpPreference -ExclusionPath 'C:\Windows\Temp\winagent-v*.exe' - Add-MpPreference -ExclusionPath 'C:\Program Files\Mesh Agent\*' - Add-MpPreference -ExclusionPath 'C:\Windows\Temp\trmm*\*' - + $DefenderStatus = Get-MpComputerStatus | select AntivirusEnabled + if ($DefenderStatus -match "True") { + Add-MpPreference -ExclusionPath 'C:\Program Files\TacticalAgent\*' + Add-MpPreference -ExclusionPath 'C:\Windows\Temp\winagent-v*.exe' + Add-MpPreference -ExclusionPath 'C:\Program Files\Mesh Agent\*' + Add-MpPreference -ExclusionPath 'C:\Windows\Temp\trmm*\*' + } Invoke-WebRequest -Uri $downloadlink -OutFile $OutPath\$output Start-Process -FilePath $OutPath\$output -ArgumentList ('/VERYSILENT /SUPPRESSMSGBOXES') -Wait write-host ('Extracting...')