Files
management-scripts/Install-LiquidFilesOutlookAgent.ps1
T

44 lines
1.6 KiB
PowerShell
Raw Normal View History

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
If (-not [string]::IsNullOrEmpty($LFHost) ) {
2021-08-10 13:28:34 -04:00
LogMsg "LiquidFiles target server: ${LFHost}"
$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) {
LogMsg "Stopping the LiquidFiles agent"
$RunningProcess | Stop-Process -Force
}
2023-06-02 09:59:01 -04:00
# Run the installer
2021-05-06 11:57:17 -04:00
$INSTALLER = Download-File -URL $MSIURL
LogMsg "Installing Liquid Files Outlook Agent from ""${INSTALLER}"""
Try { Start-Process "msiexec.exe" -ArgumentList "/i ${INSTALLER} /qn /norestart ${INSTALLER_ARGS}" -Wait -ErrorAction Stop }
Catch { LogErr $_.Exception.Message }
2023-06-02 09:59:01 -04:00
# Delete installer
2021-05-06 11:57:17 -04:00
Try {
2021-05-24 14:05:59 -04:00
LogMsg "Deleting downloaded installation package"
Remove-Item $INSTALLER -Force -ErrorAction SilentlyContinue
2021-05-06 11:57:17 -04:00
}
2022-06-16 16:52:17 -04:00
Catch { LogErr $_.Exception.Message }
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"
If ( Test-Path $PathToAgentExe64 ) {
$PathToAgentExe = $PathToAgentExe64
} ElseIf ( Test-Path $PathToAgentExe32 ) {
$PathToAgentExe = $PathToAgentExe32
}
2022-06-16 16:52:17 -04:00
If ($PathToAgentExe) {
LogMsg "Starting LiquidFiles agent"
Try { Start-Process $PathToAgentExe }
Catch { LogErr $_.Exception.Message }
}