move powershell module installs to Tools.ps1

update Install-EmberkomCloudBackup.ps1
This commit is contained in:
2021-09-23 13:14:16 -04:00
parent 2b8d833100
commit ce5f25e01f
4 changed files with 40 additions and 58 deletions
+5 -9
View File
@@ -15,10 +15,11 @@ switch ( $Edition.ToLower() ) {
default { $URL = $ECB_WIN_URL; $AgentEdition = 'desktop' }
}
## Install and import the MSP360 Powershell module
Run-Script -LivePSScript Install-MSP360PowershellModule
LogMsg "Importing MSP360 Powershell module"
## Install and import additional Powershell modules
Install-MSP360Module
Import-Module -Name MSP360
Install-PSAteraModule
Import-Module -Name PSAtera
## Install the agent
$INSTALLER = Download-File -URL $URL
@@ -36,15 +37,10 @@ LogMsg "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
Try { Set-MBSAgentSetting -Edition $AgentEdition }
Catch { $_.Exception.Message }
## Install and import the PSAtera Powershell Module
Run-Script -LivePSScript Install-PSAteraModule
LogMsg "Importing PSAtera Powershell module"
Import-Module -Name PSAtera
Set-AteraAPIKey = $AteraAPIKey
## Get agent details and custom fields from Atera
Try {
LogMsg "Getting Atera agent and custom field information"
Set-AteraAPIKey = $AteraAPIKey
$AteraAgent = Get-AteraAgent
$MSP360Username = Get-AteraCustomValue -ObjectType Customer -ObjectId $AteraAgent.CustomerID -FieldName 'MSP360 Account Username'
$MSP360Password = Get-AteraCustomValue -ObjectType Customer -ObjectId $AteraAgent.CustomerID -FieldName 'MSP360 Account Password'