Compare commits
3
Commits
6ad53ead58
...
34672bf109
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34672bf109 | ||
|
|
864051a4f0 | ||
|
|
2502a7cca7 |
@@ -2,10 +2,10 @@
|
||||
If (! $Edition ) { $Edition = 'desktop' }
|
||||
|
||||
## Specify URL to "Backup for Windows" agent installer
|
||||
$ECB_WIN_URL = 'https://s3.amazonaws.com/cb_setups/MBS/53CFB286-7A97-4FDF-8CFA-475C0DB63A9A/EmberkomCloudBackup_v7.2.1.58_netv4.0_ALLEDITIONS_Setup_20211019212604.exe'
|
||||
$ECB_WIN_URL = 'https://s3.amazonaws.com/cb_setups/MBS/53CFB286-7A97-4FDF-8CFA-475C0DB63A9A/EmberkomCloudBackup_v7.2.2.39_netv4.0_ALLEDITIONS_Setup_20211118191645.exe'
|
||||
|
||||
## Specify URL to "Backup Virtual Machine Edition" agent installer
|
||||
$ECB_VMM_URL = 'https://s3.amazonaws.com/cb_setups/MBS/53CFB286-7A97-4FDF-8CFA-475C0DB63A9A/EmberkomCloudBackup_v7.2.1.58_netv4.0_ALLEDITIONS_Setup_20211019212604.exe'
|
||||
$ECB_VMM_URL = 'https://s3.amazonaws.com/cb_setups/MBS/53CFB286-7A97-4FDF-8CFA-475C0DB63A9A/EmberkomCloudBackup_v7.2.2.39_netv4.0_VM_Setup_20211118191354.exe'
|
||||
|
||||
## Set the correct download URL and agent edition
|
||||
switch ( $Edition.ToLower() ) {
|
||||
|
||||
@@ -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
|
||||
+28
-42
@@ -1,53 +1,39 @@
|
||||
## Make sure we have an administrative token
|
||||
If ( IsAdmin )
|
||||
{
|
||||
$URL = 'https://lfupdate.s3.amazonaws.com/clients/windows_cli/LiquidFilesCLI-2.0.128.zip'
|
||||
|
||||
## Filename we'll download to
|
||||
$FILENAME = Split-Path -Leaf $URL
|
||||
|
||||
## Full path for the downloaded zip file
|
||||
$ZIP = "${Global:ToolsDirectory}\${FILENAME}"
|
||||
|
||||
## Once we extract the zip file, this will be the exe name inside
|
||||
$EXE = '{0}.exe' -f [System.IO.Path]::GetFileNameWithoutExtension($FILENAME)
|
||||
|
||||
## Delete the zip file if it already exists
|
||||
If ( Test-Path $ZIP ) {
|
||||
LogMsg "Deleting existing file: ${ZIP}"
|
||||
Try { Remove-Item $ZIP -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Delete the exe file if it already exists
|
||||
If ( Test-Path $EXE ) {
|
||||
LogMsg "Deleting existing file: ${EXE}"
|
||||
Try { Remove-Item $EXE -Force }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
|
||||
## Download and unzip LiquidFiles CLI utility
|
||||
Download-File -URL $URL -File $ZIP
|
||||
Unzip-Object $ZIP
|
||||
|
||||
## Set the properties for the message
|
||||
$From = $Env:COMPUTERNAME
|
||||
$Subject = [System.IO.Path]::GetFileNameWithoutExtension($ZIP)
|
||||
$Message = ""
|
||||
If ( $LFCLI ) {
|
||||
|
||||
## Create the path to $FileToUpload and zip the specified directory if necessary
|
||||
If ( $(Get-Item $DataToUpload) -is [System.IO.DirectoryInfo] ) {
|
||||
$FileToUpload = '{0}\{1}.zip' -f $Global:OutputDirectory,$(Split-Path -Leaf $path)
|
||||
$FileToUpload = '{0}\{1}.zip' -f $Global:OutputDirectory,$(Split-Path -Leaf $DataToUpload)
|
||||
Zip-Object -path $DataToUpload -dest $FileToUpload
|
||||
$DeleteAfterUpload = $true
|
||||
}
|
||||
Else { $FileToUpload = $DataToUpload }
|
||||
Else {
|
||||
$FileToUpload = $DataToUpload
|
||||
$DeleteAfterUpload = $false
|
||||
}
|
||||
|
||||
Install-PSAteraModule
|
||||
Import-Module -Name PSAtera
|
||||
Set-AteraAPIKey -APIKey $AteraAPIKey
|
||||
$LFHost = $(Get-AteraCustomValue -ObjectType Customer -ObjectId 9 -FieldName 'LiquidFiles Host URL').ValueAsString
|
||||
$FiledropURL = "${LFHost}/filedrop/cmd"
|
||||
|
||||
## Set the message properties for the file upload
|
||||
$From = '{0}@{1}.net' -f $Env:COMPUTERNAME,$($Global:MSPName -replace " ","").ToLower()
|
||||
$Subject = [System.IO.Path]::GetFileNameWithoutExtension($FileToUpload)
|
||||
$Message = ""
|
||||
|
||||
If ( Test-Path $FileToUpload ) {
|
||||
LogMsg "Uploading ""${FileToUpload}"""
|
||||
Try { Start-Process "${EXE}" -ArgumentList "filedrop /url:xfer.emberkom.net /from:""${From}"" /subject:""${Subject}"" /msg:""${Message}"" /c:n /deleteAfterUpload /f:""${ZIP}""" -Wait }
|
||||
|
||||
If ( $DeleteAfterUpload ) {
|
||||
Try { Start-Process "${LFCLI}" -ArgumentList "filedrop /url:${FiledropURL} /from:""${From}"" /subject:""${Subject}"" /msg:""${Message}"" /c:n /deleteAfterUpload /f:""${FileToUpload}""" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
Else { LogMsg "The specified file does not exist: ""${FileToUpload}""" }
|
||||
|
||||
Else {
|
||||
Try { Start-Process "${LFCLI}" -ArgumentList "filedrop /url:${FiledropURL} /from:""${From}"" /subject:""${Subject}"" /msg:""${Message}"" /c:n /f:""${FileToUpload}""" -Wait }
|
||||
Catch { LogErr $_.Exception.Message }
|
||||
}
|
||||
Else { LogMsg "Must be an administrator to upload files" }
|
||||
}
|
||||
Else { LogMsg "The specified file does not exist: ""${FileToUpload}""" }
|
||||
}
|
||||
Else { LogMsg "Could not upload any data because the LiquidFiles CLI tool was not found" }
|
||||
|
||||
Reference in New Issue
Block a user