# Set a default Site Token if the client Site token is not set up yet
$defaultSiteToken = $siteToken
$softwareVersion = "UNKNOWN"
$osVersion = "UNKNOWN"
$SourceFileUrl = "https://ark.mwbsys.com/epa.win.installer.x64/release"
if ([Environment]::Is64BitProcess) {
$softwareVersion = "Setup.MBEndpointAgent.x64.msi"
$osVersion = "64bit"
$SourceFileUrl = "https://ark.mwbsys.com/epa.win.installer.x64/release"
}
else {
$softwareVersion = "Setup.MBEndpointAgent.msi"
$osVersion = "32bit"
$SourceFileUrl = "https://ark.mwbsys.com/epa.win.installer/release"
}
Write-Host "OS Version $osVersion"
$edrVersion = $softwareVersion
$Temp = "MSP_Temp"
$DestinationFilePath = "c:\$Temp\$edrVersion"
$TempFolder = "C:\$Temp\"
if (Test-Path $TempFolder) {
Write-Host "Folder $TempFolder exists"
# Perform delete file from folder operation if needed
}
else {
# PowerShell Create directory if it doesn't exist
New-Item $TempFolder -ItemType Directory
Write-Host "Folder [$TempFolder] created successfully"
}
Write-Host "Downloading [$SourceFileUrl] to [$DestinationFilePath]"
try {
(New-Object System.Net.WebClient).DownloadFile($SourceFileUrl, $DestinationFilePath)
}
catch {
throw "File download failed: $($_.Exception.Message)"
}
# If the file was downloaded successfully, then run the installation
if (Test-Path $DestinationFilePath -ErrorAction Ignore) {
try {
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$DestinationFilePath`" NEBULA_ACCOUNTTOKEN=$siteToken /quiet" -Wait
Write-Host "Installed $edrVersion on $AssetName for $CustomerName"
if (Test-Path $TempFolder) {
# Perform delete folder after installation
try {
# Get-ChildItem $TempFolder | Remove-Item -Recurse -Force
# Write-Host "Deleted [$TempFolder]"
}
catch {
throw $_.Exception.Message
}
}
}
catch {
throw $_.Exception.Message
}
}
else {
throw "File not found at $DestinationFilePath"
}
Script data
Language - PowerShell
Run as - System / Root User
Script timeout duration - 5 Mins
Script variables
Placeholder Variables
siteToken -
CustomerName - Client name
AssetName - Asset name
Read me
This script will work to install Malwarebytes as long as you have the following Placeholder variables defined. $siteToken: Account Token as provided by Malwarebytes. "Account Token" needs to be defined in the Settings->Managed Fields->Clients tab. The field should be a Text field that can be populated with the Account Token. Then map the filed to the $siteToken parameter. $CustomerName: Client Name $AssetName: Asset Name https://service.malwarebytes.com/hc/en-us/articles/16733851276563-Download-and-install-the-Nebula-endpoint-agent-with-a-generic-installer