# Path to the MSI installer $URL = 'https://enscape-installer.chaosgroup.com/installer.enscape.io/Enscape-4.0.0.579.exe' # Set path to temp directory $TEMPDIR = '{0}enscape-installer' -f (Get-TempPath) # Recursively delete $TEMPDIR if it already exists If ( Test-Path $TEMPDIR ) { Write-Output """${TEMPDIR}"" already exists and will be deleted" Try { Remove-Item -Path $TEMPDIR -Recurse -Force -ErrorAction SilentlyContinue } Catch { Write-Error $_.Exception.Message } } # Create $TEMPDIR Write-Output "Creating: ${TEMPDIR}" Try { New-Item -Path $TEMPDIR -ItemType Directory -Force -ErrorAction Stop } Catch { Write-Error $_.Exception.Message ; Return } # Write $CONFIG to config.xml $CONFIG = @' 1 C:\Program Files\Enscape 1 1 en-US 1 1 '@ Try { $CONFIG | WriteToFile_UTF8NoBOM -FilePath "${TEMPDIR}\config.xml" } Catch { Write-Output "Cannot write configuration file! This script will exit." ; Write-Error $_.Exception.Message ; Return } # Download the installer $Installer = "${TEMPDIR}\$(Split-Path $URL -Leaf)" Download-File -URL $URL -File $Installer # Install package If ( !(Test-Path $Installer) ) { Write-Output "Cannot download installer! This script will exit." ; Return } Write-Output "Installing Enscape from ""${Installer}""" Start-Process $Installer -ArgumentList "-gui=0 -acceptEULA -configFile=""${TEMPDIR}\config.xml"" -quiet=1 -ignoreErrors=1" -Wait # Delete the installer Write-Output "Deleting temp directory and its contents" Try { Remove-Item -Path $TEMPDIR -Recurse -Force -ErrorAction SilentlyContinue } Catch { Write-Error $_.Exception.Message }