Jump to content

Install MalwareBytes with PowerShell


kavaa

Recommended Posts

I made a install script for MalwareBytes to do a Silent install.

UPDATED VERSION 2 With auto detect if Invoke-WebRequest exists

Improvements are welcome!

Change the version if needed in the Source URL: https://data-cdn.mbamupdates.com/web/mb3-setup-consumer-3.0.6.1469.exe

# Silent Install MalwareBytes 
# Download URL: https://www.malwarebytes.com/mwb-download/thankyou/

# Path for the workdir
$workdir = "c:\installer\"

# Check if work directory exists if not create it

If (Test-Path -Path $workdir -PathType Container)
{ Write-Host "$workdir already exists" -ForegroundColor Red}
ELSE
{ New-Item -Path $workdir  -ItemType directory }

# Download the installer

$source = "https://data-cdn.mbamupdates.com/web/mb3-setup-consumer-3.0.6.1469.exe"
$destination = "$workdir\mbam.exe"
Invoke-WebRequest $source -OutFile $destination

# Start the installation

Start-Process -FilePath "$workdir\mbam.exe" -ArgumentList "/NOCANCEL /NORESTART /VERYSILENT /SUPPRESSMSGBOXES"

# Wait XX Seconds for the installation to finish

Start-Sleep -s 35

# Remove the installer

rm -Force $workdir\mbam*

For Windows 7 please change 

$source = "https://data-cdn.mbamupdates.com/web/mb3-setup-consumer-3.0.6.1469.exe"
$destination = "$workdir\mbam.exe"
Invoke-WebRequest $source -OutFile $destination

To

$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile("https://data-cdn.mbamupdates.com/web/mb3-setup-consumer-3.0.6.1469.exe","$workdir\mbam.exe")

Since Powershell in Windows 7 does not support the Invoke-WebRequest

 

Link to comment
Share on other sites

I did some checks with command line options to initiate a Scan, but it would not let me do it.

Link to the switches: http://www.gegeek.com/documents/B16E4181A9CDD6828ECADB10CD9204EF472E2E04.html

mbam.exe ⁄parameter
(where parameter is one of the following)
 
⁄debug: allows you to collect information to send as a bug report.
⁄developer: this command line parameter is explained in the false positives section.
⁄minimized: allows you to start the program minimized.
⁄quickscan: allows you to run a quick scan.
⁄quickscanterminate: allows you to run a quick scan. Program terminates if no items found.
⁄fullscan: allows you to run a full scan.
⁄fullscanterminate: allows you to run a full scan. Program terminates if no items found.
⁄runupdate: allows you to update the program without displaying result dialogs.
⁄register: allows you to register the program without displaying main dialog.
⁄fullauto: allows you to run a full scan silently.
 
 
Examples
⁄updateshowdialog: allows you to update the program displaying all dialogs.
⁄schedule : allows you to schedule an update and scan for a specific hour. Scan will happen 5 minutes after update.
 
Example: mbam.exe ⁄schedule 0 (will schedule for 12:00 AM local time)
Example: mbam.exe ⁄schedule 5 (will schedule for 5:00 AM local time)
Example: mbam.exe ⁄schedule 23 (will schedule for 11:00 PM local time)

If someone has got this to work with the free or activated version let me know.

I think it would only work with the enterprise version, and they removed the options form the Free / Activated Version

Link to comment
Share on other sites

Version 2

This version will check if the Invoke-WebRequest Command exists or not. For legacy Systems like Windows 7 you than only have one Script and don't need to change things in Pulseway

# Silent Install MalwareBytes 
# Download URL: https://www.malwarebytes.com/mwb-download/thankyou/

# Path for the workdir
$workdir = "c:\installer\"

# Check if work directory exists if not create it

If (Test-Path -Path $workdir -PathType Container)
{ Write-Host "$workdir already exists" -ForegroundColor Red}
ELSE
{ New-Item -Path $workdir  -ItemType directory }

# Download the installer

$source = "https://data-cdn.mbamupdates.com/web/mb3-setup-consumer-3.0.6.1469.exe"
$destination = "$workdir\mbam.exe"

# Check if Invoke-Webrequest exists otherwise execute WebClient

if (Get-Command 'Invoke-Webrequest')
{
     Invoke-WebRequest $source -OutFile $destination
}
else
{
    $WebClient = New-Object System.Net.WebClient
    $webclient.DownloadFile($source, $destination)
}

# Start the installation

Start-Process -FilePath "$workdir\mbam.exe" -ArgumentList "/NOCANCEL /NORESTART /VERYSILENT /SUPPRESSMSGBOXES"

# Wait XX Seconds for the installation to finish

Start-Sleep -s 35

# Remove the installer

rm -Force $workdir\mbam*

 

Link to comment
Share on other sites

  • 11 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...