2022-12-15 13:35:21 -05:00
|
|
|
# This script requires the $Edition variable is set from the RMM script
|
|
|
|
|
If (! $Edition ) { $Edition = 'desktop' }
|
|
|
|
|
|
|
|
|
|
# Set the correct download URL and agent edition
|
|
|
|
|
switch ( $Edition.ToLower() ) {
|
2023-01-04 10:41:10 -05:00
|
|
|
'server' { $AgentEdition = 'baremetal' }
|
|
|
|
|
'desktop' { $AgentEdition = 'desktop' }
|
|
|
|
|
'vm' { $AgentEdition = 'vmedition' }
|
|
|
|
|
default { $AgentEdition = 'desktop' }
|
2022-12-15 13:35:21 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Install and import additional Powershell module
|
2023-12-07 12:06:38 -05:00
|
|
|
Import-MSP360Module
|
2022-12-15 13:35:21 -05:00
|
|
|
|
2024-02-01 11:03:10 -05:00
|
|
|
# Exit this script if the agent is not installed
|
|
|
|
|
If ( !($(Get-MBSAgent -ErrorAction SilentlyContinue)) ) {
|
|
|
|
|
Microsoft.Powershell.Utility\Write-Output "Backup agent is not installed. This script will now exit."
|
|
|
|
|
Return
|
|
|
|
|
}
|
2022-12-15 13:35:21 -05:00
|
|
|
|
|
|
|
|
# Set the agent edition
|
2023-10-05 13:11:38 -04:00
|
|
|
Write-Output "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
|
2024-02-01 11:03:10 -05:00
|
|
|
Try {
|
|
|
|
|
Switch ([string]::IsNullOrEmpty($MasterPassword)) {
|
|
|
|
|
$true { Set-MBSAgentSetting -Edition $AgentEdition -Verbose }
|
|
|
|
|
$false { Set-MBSAgentSetting -Edition $AgentEdition -MasterPassword (ConvertTo-SecureString -String $MasterPassword -AsPlainText -Force) -Verbose }
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-10-05 13:17:18 -04:00
|
|
|
Catch { Write-Error $_.Exception.Message }
|
2022-12-15 13:35:21 -05:00
|
|
|
|
|
|
|
|
# Delete the desktop icon
|
2023-10-06 14:16:19 -04:00
|
|
|
Write-Output "Removing desktop icon"
|
|
|
|
|
Remove-Item -Path "${Env:PUBLIC}\Desktop\Emberkom Backup.LNK" -Force -ErrorAction SilentlyContinue
|
|
|
|
|
Remove-Item -Path "${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" -Force -ErrorAction SilentlyContinue
|