Files
management-scripts/Install-Enscape.ps1
T

48 lines
2.0 KiB
PowerShell
Raw Normal View History

2024-04-16 12:29:18 -04:00
# Path to the MSI installer
2024-07-03 15:56:09 -04:00
$URL = 'https://enscape-installer.chaosgroup.com/installer.enscape.io/Enscape-4.0.2.11.exe'
2024-04-16 12:29:18 -04:00
# 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 }
2022-09-30 11:48:18 -04:00
}
2024-04-16 12:29:18 -04:00
# 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 = @'
<DefValues>
<Value Name="INSTALL_SKETCHUP" DataType="value">1</Value>
<Value Name="STDROOT" DataType="value">C:\Program Files\Enscape</Value>
<Value Name="INSTALL_RHINO" DataType="value">1</Value>
<Value Name="INSTALL_ARCHICAD" DataType="value">1</Value>
<Value Name="LOCALE" DataType="value">en-US</Value>
<Value Name="INSTALL_REVIT" DataType="value">1</Value>
<Value Name="INSTALL_VECTORWORKS" DataType="value">1</Value>
</DefValues>
'@
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
2024-04-16 12:34:34 -04:00
If ( !(Test-Path $Installer) ) { Write-Output "Cannot download installer! This script will exit." ; Return }
Write-Output "Installing Enscape from ""${Installer}"""
2024-04-16 12:35:46 -04:00
Start-Process $Installer -ArgumentList "-gui=0 -acceptEULA -configFile=""${TEMPDIR}\config.xml"" -quiet=1 -ignoreErrors=1" -Wait
2024-04-16 12:38:12 -04:00
# 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 }