use Install-MBSAgent cmdlet instead of manual install

This commit is contained in:
2021-09-23 14:50:36 -04:00
parent d5b870bc48
commit 88de4abcb1
+9 -7
View File
@@ -22,15 +22,17 @@ Install-PSAteraModule
Import-Module -Name PSAtera Import-Module -Name PSAtera
## Install the agent ## Install the agent
$INSTALLER = Download-File -URL $URL #$INSTALLER = Download-File -URL $URL
LogMsg "Installing Emberkom Cloud Backup agent" LogMsg "Installing Emberkom Cloud Backup agent"
Try { Start-Process $INSTALLER -ArgumentList "/S" -Wait } Try { Install-MBSAgent -URL $URL -Force }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
If ( Test-Path $INSTALLER ) { #Try { Start-Process $INSTALLER -ArgumentList "/S" -Wait }
LogMsg "Deleting Emberkom Cloud Backup agent installer: ""${INSTALLER}""" #Catch { LogErr $_.Exception.Message }
Try { Remove-Item $INSTALLER -Force } #If ( Test-Path $INSTALLER ) {
Catch { LogErr $_.Exception.Message } # LogMsg "Deleting Emberkom Cloud Backup agent installer: ""${INSTALLER}"""
} # Try { Remove-Item $INSTALLER -Force }
# Catch { LogErr $_.Exception.Message }
#}
## Set the agent edition ## Set the agent edition
LogMsg "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition""" LogMsg "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""