# Path to the MSI installer $MSIURL = 'https://lfupdate.s3.amazonaws.com/clients/outlook/admin_msi/LiquidFiles_OutlookPlugin_Admin_3.0.37.msi' # Set installer args If (-not [string]::IsNullOrEmpty($LFHost) ) { Write-Output "LiquidFiles target server: ${LFHost}" $INSTALLER_ARGS = "REGKEYSCRIPT=""BaseUrl=${LFHost};InjectPositionDefault=3""" } Else { $INSTALLER_ARGS = '' } # Stop any running LiquidFilesWindowsAgent process $RunningProcess = Get-Process -Name "LiquidFilesWindowsAgent" If ($RunningProcess) { Write-Output "Stopping the LiquidFiles agent" $RunningProcess | Stop-Process -Force } # Uninstall existing LiquidFiles agent/plugin 'LiquidFiles*' | Uninstall-MSI # Run the installer $INSTALLER = Download-File -URL $MSIURL Write-Output "Installing Liquid Files Outlook Agent from ""${INSTALLER}""" Try { Start-Process "msiexec.exe" -ArgumentList "/i ${INSTALLER} /qn /norestart ${INSTALLER_ARGS}" -Wait -ErrorAction Stop } Catch { Write-Error $_.Exception.Message } # Delete installer Try { Write-Output "Deleting downloaded installation package" Remove-Item $INSTALLER -Force -ErrorAction SilentlyContinue } Catch { Write-Error $_.Exception.Message } # Start the agent $PathToAgentExe64 = "${Env:ProgramFiles(x86)}\LiquidFiles Windows Agent\LiquidFilesWindowsAgent.exe" $PathToAgentExe32 = "${Env:ProgramFiles}\LiquidFiles Windows Agent\LiquidFilesWindowsAgent.exe" If ( Test-Path $PathToAgentExe64 ) { $PathToAgentExe = $PathToAgentExe64 } ElseIf ( Test-Path $PathToAgentExe32 ) { $PathToAgentExe = $PathToAgentExe32 } If ($PathToAgentExe) { Write-Output "Starting LiquidFiles agent" Try { Start-Process $PathToAgentExe } Catch { Write-Error $_.Exception.Message } }