major update to override Write-Output func
This commit is contained in:
@@ -5,19 +5,19 @@ $TEMPDIR = '{0}eset-protect-deployment' -f (Get-TempPath)
|
||||
|
||||
# Recursively delete $TEMPDIR if it already exists
|
||||
If ( Test-Path $TEMPDIR ) {
|
||||
LogMsg """${TEMPDIR}"" already exists and will be deleted"
|
||||
Write-Output """${TEMPDIR}"" already exists and will be deleted"
|
||||
Try { Remove-Item -Path $TEMPDIR -Recurse -Force -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
# Create $TEMPDIR
|
||||
LogMsg "Creating: ${TEMPDIR}"
|
||||
Write-Output "Creating: ${TEMPDIR}"
|
||||
Try { New-Item -Path $TEMPDIR -ItemType Directory -Force -ErrorAction Stop }
|
||||
Catch { LogErr $_.Exception.Message ; Exit }
|
||||
|
||||
# Write $CONFIG to install_config.ini
|
||||
Try { $CONFIG | WriteToFile_UTF8NoBOM -FilePath "${TEMPDIR}\install_config.ini" }
|
||||
Catch { LogMsg "Cannot write configuration file! This script will exit." ; LogErr $_.Exception.Message ; Exit }
|
||||
Catch { Write-Output "Cannot write configuration file! This script will exit." ; LogErr $_.Exception.Message ; Exit }
|
||||
|
||||
# Get bitness of endpoint and set $AGENTNAME
|
||||
If ( Is64bit ) { $AGENTNAME = "agent_x64.msi" } Else { $AGENTNAME = "agent_x86.msi" }
|
||||
@@ -25,15 +25,15 @@ 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
|
||||
LogMsg "Downloading ESET Management Agent"
|
||||
Write-Output "Downloading ESET Management Agent"
|
||||
Download-File -URL $URL -File $INSTALLER
|
||||
|
||||
# Install the app
|
||||
LogMsg "Installing ESET Management Agent from ""${INSTALLER}"""
|
||||
Write-Output "Installing ESET Management Agent from ""${INSTALLER}"""
|
||||
Try { Start-Process "msiexec.exe" -ArgumentList "/i ${INSTALLER} /qn /norestart /log installer.log" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
# Delete the installer
|
||||
LogMsg "Deleting temp directory and its contents"
|
||||
Write-Output "Deleting temp directory and its contents"
|
||||
Try { Remove-Item -Path $TEMPDIR -Recurse -Force -ErrorAction SilentlyContinue }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
|
||||
Reference in New Issue
Block a user