Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94d47954cd | ||
|
|
60df390c1b |
@@ -1,5 +1,11 @@
|
|||||||
# NOTE: The $CONFIG variable must be set by the calling script
|
# NOTE: The $CONFIG variable must be set by the calling script
|
||||||
|
|
||||||
|
# Exit this script if agent is already installed
|
||||||
|
If ( Test-Path "${Env:ProgramFiles}\ESET\RemoteAdministrator\Agent\ERAAgent.exe" ) {
|
||||||
|
Microsoft.Powershell.Utility\Write-Output "ESET agent is already installed. This script will now exit."
|
||||||
|
Return
|
||||||
|
}
|
||||||
|
|
||||||
# Set path to temp directory
|
# Set path to temp directory
|
||||||
$TEMPDIR = '{0}eset-protect-deployment' -f (Get-TempPath)
|
$TEMPDIR = '{0}eset-protect-deployment' -f (Get-TempPath)
|
||||||
|
|
||||||
|
|||||||
@@ -15,35 +15,33 @@ switch ( $Edition.ToLower() ) {
|
|||||||
# Install and import additional Powershell module
|
# Install and import additional Powershell module
|
||||||
Import-MSP360Module
|
Import-MSP360Module
|
||||||
|
|
||||||
# Install the agent if it's not currently installed
|
# Exit this script if the agent is already installed
|
||||||
If ( -not $(Get-MBSAgent) ) {
|
If ( $(Get-MBSAgent) ) {
|
||||||
|
Microsoft.Powershell.Utility\Write-Output "Backup agent is already installed. This script will now exit."
|
||||||
# Download the installer
|
Return
|
||||||
$Installer = Download-File -URL $URL
|
|
||||||
|
|
||||||
# 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 }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Download the installer
|
||||||
|
$Installer = Download-File -URL $URL
|
||||||
|
# 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 }
|
||||||
|
|
||||||
# Delete the desktop icon
|
# Delete the desktop icon
|
||||||
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 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 }
|
If ( Test-Path "${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" ) { Remove-Item -Path "${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" -Force -ErrorAction SilentlyContinue }
|
||||||
|
|||||||
Reference in New Issue
Block a user