Skip to main content

Malicious Software Removal Tool Scanner

Summary

This script will download and run the latest version of the Microsoft Malicious Software Removal Tool Scanner, logging the results and emailing them to the specified email address. It also provides an option to perform an autofix for any detected infections.

Please get the following file hashes approved for this script to work if the environment has a security block application:

  • ED06AECD5686944B0A5E5D76C1E7A9EA --> Audit MSRT.ps1 script
  • C8759C7E4979819C0BB39DAF4DC64124 --> MSRTAutofix.ps1 script

Sample Run

Run with SetEnvironment = 1 to set the EDFs the first time this script is imported.

Sample Run Image 1

After the SetEnvironment is set, please refer to the sample execution.

Sample Run Image 2

Variables

NameDescription
ScanResultThis stores the scan result of the Malicious Software Removal Tool.

EDF

NameLevelSectionTypeEditableDescription
MSRT Scanner EnableClientSoftwareCheckboxYesThis EDF check will enable the MSRT scan automation via the Internal Monitor - MSRT Scanner Execute.
MSRT Scanner ExcludeLocationExclusionsCheckboxYesThis EDF check will exclude the location from the MSRT scan automation via the Internal Monitor - MSRT Scanner Execute.
MSRT Scanner ExcludeComputerExclusionsCheckboxYesThis EDF check will exclude the computer from the MSRT scan automation via the Internal Monitor - MSRT Scanner Execute.
MSRT Scanner ResultComputerSoftwareTextNoThis EDF stores the scan result, conclusive output, and date when the scanning occurred in the format example: "Infection Not Found -- M/DD/YYYY hh:mm:ss".

User Parameters

NameExampleRequiredDescription
Send_ScanReport_To_Emailabc@test.com; xyz@test.comFalseThis stores the email addresses of users to whom the scan report of MSRT needs to be sent. Use a semicolon (;) to separate multiple email addresses so that a report can be sent to multiple users at a time.
Allow_Autofix1FalseIf this user parameter is set to 1, then if an infection is detected, the MSRT /F:Y (force scan and automatic cleaning of infection) will be scheduled.
SetEnvironment1FalseIf this is set, then it will import the EDFs.

Global Parameter

NameExampleRequiredDescription
Email_On_No_Infection1 or 0FalseIf set to 1, the user will receive an email for the no infection message with the attached report.

Output

  • Script log
  • Local file on the computer: C:/WINDOWS/debug/mrt.log