Files
management-scripts/Fix-EmberkomCloudBackupProductEdition.ps1
T
2023-12-07 12:06:38 -05:00

32 lines
1.3 KiB
PowerShell

# 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() ) {
'server' { $AgentEdition = 'baremetal' }
'desktop' { $AgentEdition = 'desktop' }
'vm' { $AgentEdition = 'vmedition' }
default { $AgentEdition = 'desktop' }
}
# Install and import additional Powershell module
Import-MSP360Module
# Add backup user to installed product
#Try {
# $MSP360Password = ConvertTo-SecureString -string $MSP360Password -AsPlainText -Force
# Write-Output "Adding backup user account: ${MSP360Username}"
# Add-MBSUserAccount -User $MSP360Username -Password $MSP360Password
#}
#Catch { Write-Error $_.Exception.Message }
# Set the agent edition
# Note: the product edition must be set *after* the user is added
Write-Output "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
Try { Set-MBSAgentSetting -Edition $AgentEdition -Verbose }
Catch { Write-Error $_.Exception.Message }
# Delete the desktop icon
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