Compare commits
2
Commits
c94b375aec
...
b698f4337d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b698f4337d | ||
|
|
1f69a746c9 |
@@ -10,8 +10,7 @@ switch ( $Edition.ToLower() ) {
|
||||
}
|
||||
|
||||
# Install and import additional Powershell module
|
||||
Install-MSP360Module
|
||||
Import-Module -Name MSP360
|
||||
Import-MSP360Module
|
||||
|
||||
# Add backup user to installed product
|
||||
#Try {
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
# This script requires the $Edition variable is set from the RMM script
|
||||
If (! $Edition ) { $Edition = 'desktop' }
|
||||
|
||||
# Specify URL to "Backup for Windows" agent installer
|
||||
# Specify URL to "Backup for Windows" agent installer
|
||||
$ECB_WIN_URL = 'https://s3.amazonaws.com/cb_setups/MBS/53CFB286-7A97-4FDF-8CFA-475C0DB63A9A/Brands/FB8308E2-448A-4645-A5F6-A3632A7E57F4/EmberkomCloudBackup_v7.9.1.152_ALLEDITIONS_Setup.exe'
|
||||
|
||||
# Specify URL to "Backup Virtual Machine Edition" agent installer
|
||||
@@ -16,32 +13,37 @@ switch ( $Edition.ToLower() ) {
|
||||
}
|
||||
|
||||
# Install and import additional Powershell module
|
||||
Install-MSP360Module
|
||||
Import-Module -Name MSP360
|
||||
Import-MSP360Module
|
||||
|
||||
# Download the installer
|
||||
$Installer = Download-File -URL $URL
|
||||
# Install the agent if it's not currently installed
|
||||
If ( -not $(Get-MBSAgent) ) {
|
||||
|
||||
# Install the agent
|
||||
Write-Output "Installing Emberkom Cloud Backup agent"
|
||||
Try { Start-Process "${Installer}" -ArgumentList "/S" -Wait }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
# Download the installer
|
||||
$Installer = Download-File -URL $URL
|
||||
|
||||
# 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
|
||||
# Install the agent
|
||||
Write-Output "Installing Emberkom Cloud Backup agent"
|
||||
Try { Start-Process "${Installer}" -ArgumentList "/S" -Wait }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
|
||||
# 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 }
|
||||
|
||||
# Wait a few seconds to let the agent check-in
|
||||
Start-Sleep -Seconds 10
|
||||
|
||||
# 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 }
|
||||
}
|
||||
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
|
||||
If ( Test-Path "${Env:PUBLIC}\Desktop\Emberkom Backup.LNK" ) { Remove-Item -Path "${Env:PUBLIC}\Desktop\Emberkom Backup.LNK" -Force -ErrorAction SilentlyContinue }
|
||||
If ( Test-Path "${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" ) { Remove-Item -Path "${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" -Force -ErrorAction SilentlyContinue }
|
||||
|
||||
@@ -569,19 +569,15 @@ Function Disable-Log {
|
||||
}
|
||||
|
||||
# Function to install the MSP360 Powershell module
|
||||
Function Install-MSP360Module {
|
||||
Function Import-MSP360Module {
|
||||
Try {
|
||||
$module = Get-Module -ListAvailable -Name MSP360
|
||||
If ( (-not $module) -and (IsAdmin) ) {
|
||||
Write-Output "Installing MSP360 Powershell module"
|
||||
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://git.io/JUSAA')
|
||||
Install-MSP360Module
|
||||
}
|
||||
ElseIf ( (-not $module) -and (-not (IsAdmin)) ) {
|
||||
Write-Output "The MSP360 Powershell module needs to be installed, but the current security context is not sufficient to install it"
|
||||
}
|
||||
If ( -not (IsAdmin) ) { Write-Output "The MSP360 Powershell module needs to be installed, but the current account is not an administrative user" ; Return }
|
||||
Write-Output "Installing MSP360 Powershell module"
|
||||
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://git.io/JUSAA')
|
||||
Install-MSP360Module
|
||||
Import-Module -Name MSP360
|
||||
}
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
}
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
## Install and import additional Powershell modules
|
||||
Install-MSP360Module
|
||||
Import-Module -Name MSP360
|
||||
# Install and import additional Powershell modules
|
||||
Import-MSP360Module
|
||||
|
||||
## Uninstall the agent
|
||||
# Uninstall the agent
|
||||
Write-Output "Uninstalling Emberkom Cloud Backup agent"
|
||||
Try { Remove-MBSAgent -RemoveSettings -Force }
|
||||
Catch { Write-Error $_.Exception.Message }
|
||||
|
||||
Reference in New Issue
Block a user