Compare commits

...
2 Commits
Author SHA1 Message Date
dyoder ba077b572a added function WriteToFile_UTF8NoBOM 2022-11-11 15:11:14 -05:00
dyoder d11dad75ca switch back to standard download
use new function WriteToFile_UTF8NoBOM
2022-11-11 15:10:59 -05:00
2 changed files with 15 additions and 3 deletions
+4 -3
View File
@@ -16,7 +16,8 @@ Try { New-Item -Path $TEMPDIR -ItemType Directory -Force -ErrorAction Stop }
Catch { LogErr $_.Exception.Message ; Exit }
# Write $CONFIG to install_config.ini
Try { $CONFIG | Out-File -FilePath "${TEMPDIR}\install_config.ini" -Force -ErrorAction Stop }
#Try { $CONFIG | Out-File -FilePath "${TEMPDIR}\install_config.ini" -Force -ErrorAction Stop }
Try { $CONFIG | WriteToFile_UTF8NoBOM -FilePath "${TEMPDIR}\install_config.ini" }
Catch { LogMsg "Cannot write configuration file! This script will exit." ; LogErr $_.Exception.Message ; Exit }
# Get bitness of endpoint and set $AGENTNAME
@@ -24,8 +25,8 @@ If ( Is64bit ) { $AGENTNAME = "agent_x64.msi" } Else { $AGENTNAME = "agent_x86.m
# Download the installer
$INSTALLER = "${TEMPDIR}\${AGENTNAME}"
#$URL = 'https://download.eset.com/com/eset/apps/business/era/agent/latest/{0}' -f $AGENTNAME
$URL = 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources/eset_protect_{0}' -f $AGENTNAME
$URL = 'https://download.eset.com/com/eset/apps/business/era/agent/latest/{0}' -f $AGENTNAME
#$URL = 'https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/resources/eset_protect_{0}' -f $AGENTNAME
LogMsg "Downloading ESET Management Agent"
Download-File -URL $URL -File $INSTALLER
+11
View File
@@ -723,5 +723,16 @@ function Get-FileSizes {
LogMsg $logstr
}
# Function to write text to a file in UTF8 encoding without BOM
function WriteToFile_UTF8NoBOM {
param(
[Parameter(ValueFromPipeline=$false)][string]$FilePath,
[Parameter(ValueFromPipeline=$true)][string]$Value
)
$UTF8NoBOM = New-Object System.Text.UTF8Encoding $false
Try { [IO.File]::WriteAllText($FilePath, $CONFIG, $UTF8NoBOM) }
Catch { LogErr $_.Exception.Message }
}
Setup-MSPDirectories
Setup-LogFile