added Get-LiquidFilesCLI function

This commit is contained in:
2021-11-18 21:03:03 -05:00
parent 6ad53ead58
commit 2502a7cca7
+21
View File
@@ -582,5 +582,26 @@ function Unzip-Object ([Parameter(ValueFromPipeline=$true)][string]$path) {
Else { LogMsg "The path specified is not a zip file: ${path}" }
}
# Function to get a copy of the LiquidFiles CLI agent
function Get-LiquidFilesCLI {
$url = 'https://lfupdate.s3.amazonaws.com/clients/windows_cli/LiquidFilesCLI-2.0.128.zip'
$zip_filename = Split-Path -Leaf $url
$zip_path = "${Global:ToolsDirectory}\${zip_filename}"
$exe_path = '{0}\{1}.exe' -f $Global:ToolsDirectory,[System.IO.Path]::GetFileNameWithoutExtension($zip_filename)
If ( Test-Path $zip_path ) {
LogMsg "Deleting existing zip archive: ${zip_path}"
Try { Remove-Item -Path $zip_path -Force }
Catch { LogErr $_.Exception.Message }
}
If ( Test-Path $exe_path ) {
LogMsg "Deleting existing file: ${exe_path}"
Try { Remove-Item -Path $exe_path -Force }
Catch { LogErr $_.Exception.Message }
}
Download-File -URL $url -File $zip_path | Out-Null
Unzip-Object $zip_path
Return $exe_path
}
Setup-MSPDirectories
Setup-LogFile