Files
management-scripts/Install-EmberkomCloudBackup.ps1
T

50 lines
2.3 KiB
PowerShell
Raw Normal View History

2021-09-22 16:22:14 -04:00
## This script requires the $Edition variable is set from the RMM script
If (! $Edition ) { $Edition = 'desktop' }
2021-09-22 14:51:23 -04:00
## Specify URL to "Backup for Windows" agent installer
2021-10-19 14:29:23 -04:00
$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'
2021-09-22 14:51:23 -04:00
## Specify URL to "Backup Virtual Machine Edition" agent installer
2021-10-19 14:29:23 -04:00
$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'
2021-09-22 14:51:23 -04:00
## Set the correct download URL and agent edition
switch ( $Edition.ToLower() ) {
'server' { $URL = $ECB_WIN_URL; $AgentEdition = 'baremetal' }
'desktop' { $URL = $ECB_WIN_URL; $AgentEdition = 'desktop' }
'vm' { $URL = $ECB_VMM_URL; $AgentEdition = 'vmedition' }
default { $URL = $ECB_WIN_URL; $AgentEdition = 'desktop' }
}
## Install and import additional Powershell modules
Install-MSP360Module
2021-09-22 14:51:23 -04:00
Import-Module -Name MSP360
Install-PSAteraModule
Import-Module -Name PSAtera
2021-09-22 14:51:23 -04:00
## Install the agent
LogMsg "Installing Emberkom Cloud Backup agent"
Try { Install-MBSAgent -URL $URL -Force }
2021-09-22 14:51:23 -04:00
Catch { LogErr $_.Exception.Message }
2021-09-26 14:22:19 -04:00
## Add backup user to installed product
Try {
2021-09-23 11:35:59 -04:00
LogMsg "Getting Atera agent and custom field information"
2021-09-23 14:15:40 -04:00
Set-AteraAPIKey -APIKey $AteraAPIKey
$AteraAgent = Get-AteraAgent
2021-09-23 14:23:54 -04:00
$MSP360Username = $(Get-AteraCustomValue -ObjectType Customer -ObjectId $AteraAgent.CustomerID -FieldName 'MSP360 Account Username').ValueAsString
$MSP360Password = $(Get-AteraCustomValue -ObjectType Customer -ObjectId $AteraAgent.CustomerID -FieldName 'MSP360 Account Password').ValueAsString
$MSP360Password = ConvertTo-SecureString -string $MSP360Password -AsPlainText -Force
2021-09-23 11:35:59 -04:00
LogMsg "Adding backup user account: ${MSP360Username}"
Add-MBSUserAccount -User $MSP360Username -Password $MSP360Password
}
Catch { LogErr $_.Exception.Message }
## Set the agent edition
2021-09-26 14:22:19 -04:00
## Note: the product edition must be set *after* the user is added
LogMsg "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
Try { Set-MBSAgentSetting -Edition $AgentEdition -Verbose }
2021-10-08 05:41:49 -04:00
Catch { LogErr $_.Exception.Message }
## Delete the desktop icon
"${Env:PUBLIC}\Desktop\Emberkom Backup.LNK",
"${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" | Remove-File