0% found this document useful (0 votes)
16 views4 pages

9 Ec 0 Cad 4

The document contains command line interactions with Microsoft Windows Defender, detailing the usage of the MpCmdRun.exe utility for various tasks such as scanning for malware, updating definitions, and restoring quarantined items. It provides a comprehensive list of commands and options available for automating and troubleshooting the Microsoft Antimalware Service. Additionally, there are examples of command execution and error messages encountered during the process.

Uploaded by

itaygelman21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views4 pages

9 Ec 0 Cad 4

The document contains command line interactions with Microsoft Windows Defender, detailing the usage of the MpCmdRun.exe utility for various tasks such as scanning for malware, updating definitions, and restoring quarantined items. It provides a comprehensive list of commands and options available for automating and troubleshooting the Microsoft Antimalware Service. Additionally, there are examples of command execution and error messages encountered during the process.

Uploaded by

itaygelman21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Microsoft Windows [Version 10.0.26100.

4061]
(c) Microsoft Corporation. All rights reserved.

C:\Users\itayg> wttr.in/ashdod
’wttr.in’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\itayg> wttr .in/ashdod


’wttr’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\itayg>%ProgramFiles%\Windows Defender\MpCmdRun.exe
’C:\Program’ is not recognized as an internal or external command,
operable program or batch file.

C:\Users\itayg>"%ProgramFiles%\Windows Defender\MpCmdRun.exe"
Microsoft Antimalware Service Command Line Utility (c) 2006-2022 Microsoft Corp
Use this tool to automate and troubleshoot Microsoft Antimalware Service

Usage:
MpCmdRun.exe [command] [-options]

Command Description
-? / -h Displays all available options
for this tool
-Scan [-ScanType #] [-File <path> [-DisableRemediation] [-BootSectorScan]
[-CpuThrottling]]
[-Timeout <days>]
[-Cancel]
[-ReturnHR]
Scans for malicious software
-Trace [-Grouping #] [-Level #] Starts diagnostic tracing
-GetFiles [-SupportLogLocation <path>] Collects support information
-GetFilesDiagTrack Same as Getfiles but outputs to
temporary DiagTrack folder
-RemoveDefinitions [-All] Restores the installed
signature definitions
to a previous backup copy or to
the original default set of
signatures
[-Engine] Restore the installed engine to
the previous version saved
[-DynamicSignatures] Removes only the dynamically
downloaded signatures
-SignatureUpdate [-UNC | -MMPC] Checks for new definition updates
-Restore [-ListAll | [[-Name <name>] [-All] | [-FilePath <filePath>]] [-Path <path>]]
[-Output <fileName>] Restore or list
quarantined item(s)
-AddDynamicSignature [-Path] Loads a dynamic signature
-ListAllDynamicSignatures List the loaded dynamic signatures
-RemoveDynamicSignature [-SignatureSetID] Removes a dynamic signature
-CheckExclusion -path <path> Checks whether path is excluded

Additional Information:

Support information will be in the following directory:


C:\ProgramData\Microsoft\Windows Defender\Support

-Scan [-ScanType value]


0 Default, according to your configuration
1 Quick scan
2 Full system scan
3 File and directory custom scan

[-File <path>]
Indicates the file or directory to be scanned, only valid for custom scan.

[-DisableRemediation]
This option is valid only for custom scan.
When specified:
- File exclusions are ignored.
- Archive files are scanned.
- Actions are not applied after detection.
- Event log entries are not written after detection.
- Detections from the custom scan are not displayed in the user
interface.
- The console output will show the list of detections from the custom
scan.

[-BootSectorScan]
Enables boot sector scanning; only valid for custom scan.

[-Timeout <days>]
Timeout in days; maximum value is 30.
If this parameter is not specified, default value is 7 days for full scan
and 1 day for all other scans.

[-Cancel]
Try to cancel any ongoing quick or full scan.

[-CpuThrottling]
When specified:
- Will ensure that the scan obeys the CPU throttling as defined in the
policy (Default 50).

[-ReturnHR]
Instead of returning the default 0 or 2 values, return the actual HRESULT
of the scan command.

[DEFAULT]Return code is
0 if no malware is found or malware is successfully remediated and no additional
user action is required
2 if malware is found and not remediated or additional user action is required to
complete remediation or there is error in scanning. Please check History for more
information.
OR
HRESULT of the scan command if -ReturnHR was specified

-Trace [-Grouping value] [-Level value]


Begins tracing Microsoft Antimalware Service’s actions.
You can specify the components for which tracing is enabled and
how much information is recorded.
If no component is specified, all the components will be logged.
If no level is specified, the Error, Warning and Informational levels
will be logged. The data will be stored in the support directory
as a file having the current timestamp in its name and bearing
the extension BIN.

[-Grouping]
0x1 Service
0x2 Malware Protection Engine
0x4 User Interface
0x8 Real-Time Protection
0x10 Scheduled actions
0x20 WMI
0x40 NIS/GAPA
0x80 Windows Security Center
0x100 DLP external
0x200 Browser Protection

[-Level]
0x1 Errors
0x2 Warnings
0x4 Informational messages
0x8 Function calls
0x10 Verbose
0x20 Performance
-CaptureNetworkTrace -path <path>
Captures all the network input into the Network Protection service and
saves it to a file at <path>. Supply an empty path to stop tracing
Note: The specified path must be writable by LocalService
ex: C:\Users\Public\Downloads

-GetFiles
Gathers the following log files and packages them together in a
compressed file in the support directory

- Any trace files from Microsoft Antimalware Service


- The Windows Update history log
- All Microsoft Antimalware Service events from the System event log
- All relevant Microsoft Antimalware Service registry locations
- The log file of this tool
- The log file of the signature update helper tool

[-SupportLogLocation <path>]
Copies the support logs to the specified <path>. If <path> is not specified,
support logs will be copied to the location specified in the SupportLogLocation
Configuration.

-GetFilesDiagTrack
Same as GetFiles, but outputs the CAB file to the temp DiagTrack
directory

-RemoveDefinitions
Restores the last set of signature definitions

[-Engine]
Restores the last saved engine
Use this option to restore the previous engine.

[-All]
Removes any installed signature and engine files. Use this
option if you have difficulties trying to update signatures.

[-DynamicSignatures]
Removes all Dynamic Signatures.

-SignatureUpdate
Checks for new definition updates

[-UNC [-Path <path>]]


Performs update directly from UNC file share specified in <path>
If -Path is not specified, update will be performed directly from the
preconfigured UNC location

[-MMPC]
Performs update directly from Microsoft Malware Protection Center

-Restore
[-ListAll]
List all items that were quarantined

[-Name <name>]
Restores the most recently quarantined item based on threat name
One Threat can map to more than one file

[-All]
Restores all the quarantined items based on name

[-FilePath <filePath>]
Restores quarantined item based on file path

[-Path <path>]
Specify the path where the quarantined items will be restored.
If -Path is specified, the item will be restored to the specified path, but won’t
be removed from quarantine list.
If not specified, the item will be restored to the original path, and would be
removed from quarantine list.

[-Output <fileName>]
If -Output is specified, will output all item name(s) to a file in utf-8 encoding.

-AddDynamicSignature -Path <path>


Adds a Dynamic Signature specified by <path>

-ListAllDynamicSignatures
Lists SignatureSet ID’s of all Dynamic Signatures added to the client
via MAPS and MPCMDRUN -AddDynamicSignature

-RemoveDynamicSignature -SignatureSetID <SignatureSetID>


Removes a Dynamic Signature specified by <SignatureSetID>

-CheckExclusion -path <path>


Checks whether <path> is excluded. It can be either a path, or a file.

-TDT [-on|-off|-default]
Disable or Enable TDT feature or sets it to default. If no option is specified, it
will retrieve the current status.

-OSCA
Prints OS Copy Acceleration feature status.

-DeviceControl
-TestPolicyXml <FilePath> [-Rules | -Groups]
Validate xml policy groups and rules

-TrustCheck -File <FilePath>


Checks trust status of a file.

-ValidateMapsConnection
Validates if Defender can establish a connection to MAPS.

C:\Users\itayg>@echo off
set remotePC=PC-NAME

echo Running full Defender scan on %remotePC%...


Running full Defender scan on PC-NAME...
C:\Tools\PsExec.exe \\%remotePC% -s -d "%ProgramFiles%\Windows Defender\MpCmdRun.exe"
The system cannot find the path specified.

netsh interface set interface name="Ethernet" admin=disable


No more data is available.

You might also like