2023-06-02 09:59:01 -04:00
|
|
|
# Path to the MSI installer
|
2023-08-22 11:08:54 -04:00
|
|
|
$MSIURL = 'https://lfupdate.s3.amazonaws.com/clients/outlook/admin_msi/LiquidFiles_Admin_2.1.10.msi'
|
2020-07-31 12:44:03 -04:00
|
|
|
|
2023-06-02 09:59:01 -04:00
|
|
|
# Set installer args
|
2021-10-07 09:29:46 -04:00
|
|
|
If (-not [string]::IsNullOrEmpty($LFHost) ) {
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "LiquidFiles target server: ${LFHost}"
|
2022-09-20 15:04:47 -04:00
|
|
|
$INSTALLER_ARGS = "REGKEYSCRIPT=""BaseUrl=${LFHost};InjectPositionDefault=3"""
|
2020-07-31 12:44:03 -04:00
|
|
|
}
|
|
|
|
|
Else { $INSTALLER_ARGS = '' }
|
|
|
|
|
|
2023-06-02 09:59:01 -04:00
|
|
|
# Stop any running LiquidFilesWindowsAgent process
|
2022-06-16 16:52:17 -04:00
|
|
|
$RunningProcess = Get-Process -Name "LiquidFilesWindowsAgent"
|
|
|
|
|
If ($RunningProcess) {
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Stopping the LiquidFiles agent"
|
2022-06-16 16:52:17 -04:00
|
|
|
$RunningProcess | Stop-Process -Force
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-22 16:23:39 -04:00
|
|
|
# Uninstall existing LiquidFiles agent/plugin
|
2023-08-22 16:31:19 -04:00
|
|
|
'LiquidFiles*' | Uninstall-MSI
|
2023-08-22 16:23:39 -04:00
|
|
|
|
2023-06-02 09:59:01 -04:00
|
|
|
# Run the installer
|
2021-05-06 11:57:17 -04:00
|
|
|
$INSTALLER = Download-File -URL $MSIURL
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Installing Liquid Files Outlook Agent from ""${INSTALLER}"""
|
2021-05-06 11:57:17 -04:00
|
|
|
Try { Start-Process "msiexec.exe" -ArgumentList "/i ${INSTALLER} /qn /norestart ${INSTALLER_ARGS}" -Wait -ErrorAction Stop }
|
2023-10-05 13:17:18 -04:00
|
|
|
Catch { Write-Error $_.Exception.Message }
|
2021-05-06 11:57:17 -04:00
|
|
|
|
2023-06-02 09:59:01 -04:00
|
|
|
# Delete installer
|
2021-05-06 11:57:17 -04:00
|
|
|
Try {
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Deleting downloaded installation package"
|
2021-05-24 14:05:59 -04:00
|
|
|
Remove-Item $INSTALLER -Force -ErrorAction SilentlyContinue
|
2021-05-06 11:57:17 -04:00
|
|
|
}
|
2023-10-05 13:17:18 -04:00
|
|
|
Catch { Write-Error $_.Exception.Message }
|
2022-06-16 16:52:17 -04:00
|
|
|
|
2023-06-02 09:59:01 -04:00
|
|
|
# Start the agent
|
2023-08-22 11:53:57 -04:00
|
|
|
$PathToAgentExe64 = "${Env:ProgramFiles(x86)}\LiquidFiles Windows Agent\LiquidFilesWindowsAgent.exe"
|
|
|
|
|
$PathToAgentExe32 = "${Env:ProgramFiles}\LiquidFiles Windows Agent\LiquidFilesWindowsAgent.exe"
|
2023-08-22 11:40:27 -04:00
|
|
|
If ( Test-Path $PathToAgentExe64 ) {
|
|
|
|
|
$PathToAgentExe = $PathToAgentExe64
|
|
|
|
|
} ElseIf ( Test-Path $PathToAgentExe32 ) {
|
|
|
|
|
$PathToAgentExe = $PathToAgentExe32
|
|
|
|
|
}
|
2022-06-16 16:52:17 -04:00
|
|
|
If ($PathToAgentExe) {
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Starting LiquidFiles agent"
|
2022-06-16 16:52:17 -04:00
|
|
|
Try { Start-Process $PathToAgentExe }
|
2023-10-05 13:17:18 -04:00
|
|
|
Catch { Write-Error $_.Exception.Message }
|
2022-06-16 16:52:17 -04:00
|
|
|
}
|