minor changes
This commit is contained in:
@@ -16,33 +16,34 @@ switch ( $Edition.ToLower() ) {
|
|||||||
Import-MSP360Module
|
Import-MSP360Module
|
||||||
|
|
||||||
# Exit this script if the agent is already installed
|
# Exit this script if the agent is already installed
|
||||||
If ( $(Get-MBSAgent) ) {
|
If ( $(Get-MBSAgent -ErrorAction SilentlyContinue) ) {
|
||||||
Microsoft.Powershell.Utility\Write-Output "Backup agent is already installed. This script will now exit."
|
Microsoft.Powershell.Utility\Write-Output "Backup agent is already installed. This script will now exit."
|
||||||
Return
|
Return
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download the installer
|
# Download the installer
|
||||||
$Installer = Download-File -URL $URL
|
$Installer = Download-File -URL $URL
|
||||||
|
|
||||||
# Install the agent
|
# Install the agent
|
||||||
Write-Output "Installing Emberkom Cloud Backup agent"
|
Write-Output "Installing Emberkom Cloud Backup agent"
|
||||||
Try { Start-Process "${Installer}" -ArgumentList "/S" -Wait }
|
Try { Start-Process "${Installer}" -ArgumentList "/S" -Wait }
|
||||||
Catch { Write-Error $_.Exception.Message }
|
Catch { Write-Error $_.Exception.Message }
|
||||||
|
|
||||||
# Add backup user to installed product
|
# Add backup user to installed product
|
||||||
Try {
|
Write-Output "Adding backup user account: ${MSP360Username}"
|
||||||
$MSP360Password = ConvertTo-SecureString -string $MSP360Password -AsPlainText -Force
|
Try { Add-MBSUserAccount -User $MSP360Username -Password $(ConvertTo-SecureString -string $MSP360Password -AsPlainText -Force) }
|
||||||
Write-Output "Adding backup user account: ${MSP360Username}"
|
|
||||||
Add-MBSUserAccount -User $MSP360Username -Password $MSP360Password
|
|
||||||
}
|
|
||||||
Catch { Write-Error $_.Exception.Message }
|
Catch { Write-Error $_.Exception.Message }
|
||||||
|
|
||||||
# Wait a few seconds to let the agent check-in
|
# Wait a few seconds to let the agent check-in
|
||||||
Start-Sleep -Seconds 10
|
Start-Sleep -Seconds 10
|
||||||
|
|
||||||
# Set the agent edition
|
# Set the agent edition
|
||||||
# Note: the product edition must be set *after* the user is added
|
# Note: the product edition must be set *after* the user is added
|
||||||
Write-Output "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
|
Write-Output "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
|
||||||
Try {
|
Try {
|
||||||
Switch ([string]::IsNullOrEmpty($MasterPassword)) {
|
Switch ([string]::IsNullOrEmpty($MasterPassword)) {
|
||||||
$true { Set-MBSAgentSetting -Edition $AgentEdition -Verbose }
|
$true { Set-MBSAgentSetting -Edition $AgentEdition -Verbose }
|
||||||
$false { Set-MBSAgentSetting -Edition $AgentEdition -MasterPassword (ConvertTo-SecureString -String $MasterPassword -AsPlainText -Force) -Verbose }
|
$false { Set-MBSAgentSetting -Edition $AgentEdition -MasterPassword $(ConvertTo-SecureString -String $MasterPassword -AsPlainText -Force) -Verbose }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Catch { Write-Error $_.Exception.Message }
|
Catch { Write-Error $_.Exception.Message }
|
||||||
|
|||||||
Reference in New Issue
Block a user