Skip to content

Commit 9a1afcc

Browse files
Merge pull request #4895 from DeCohen/WI449590-amsi-demonstrations-mde-switch-image-code-snippet
convert amsi demonstration script images into code snippets
2 parents 395125f + bf11b1b commit 9a1afcc

File tree

1 file changed

+124
-13
lines changed

1 file changed

+124
-13
lines changed

defender-endpoint/mde-demonstration-amsi.md

Lines changed: 124 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ audience: ITPro
1111
ms.collection:
1212
- m365-security
1313
ms.topic: how-to
14-
ms.date: 08/19/2025
14+
ms.date: 09/01/2025
1515
search.appverid: met150
1616
ms.custom:
1717
- partner-contribution
@@ -52,17 +52,34 @@ In this demonstration article, you have two engine choices to test AMSI:
5252
```powershell
5353
$testString = "AMSI Test Sample: " + "7e72c3ce-861b-4339-8740-0ac1484c1386"
5454
Invoke-Expression $testString
55-
```
55+
```powershell
5656
57-
2. On your device, open PowerShell as an administrator.
57+
1. On your device, open PowerShell as an administrator.
5858
59-
3. Type `Powershell -ExecutionPolicy Bypass AMSI_PoSh_script.ps1`, and then press **Enter**.
59+
1. Type `Powershell -ExecutionPolicy Bypass AMSI_PoSh_script.ps1`, and then press **Enter**.
6060
6161
The result should be as follows:
6262
63-
:::image type="content" source="media/mde-demonstrations-amsi/test-amsi-powershell-results.png" alt-text="Screenshot showing the results of the AMSI test sample. It should show a threat was detected." lightbox="media/mde-demonstrations-amsi/test-amsi-powershell-results.png":::
63+
```powershell
64+
Invoke-Expression : At line:1 char:1
65+
66+
+ AMSI Test Sample: 7e72c3ce-861b-4339-8740-8ac1484c1386
67+
68+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
69+
70+
This script contains malicious content and has been blocked by your antivirus software.
71+
72+
At C:\Users\Admin\Desktop\AMSI_PoSh_script.ps1:3 char:1
73+
74+
+ Invoke-Expression $testString
75+
76+
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
77+
78+
+ CategoryInfo : ParserError: (:) [Invoke-Expression], ParseException
79+
80+
+ FullyQualifiedErrorId : ScriptContainedMaliciousContent,Microsoft.PowerShell.Commands.InvokeExpressionCommand
81+
```
6482
65-
6683
### Testing AMSI with VBScript
6784
6885
1. Save the following VBScript as `AMSI_vbscript.vbs`:
@@ -74,20 +91,63 @@ In this demonstration article, you have two engine choices to test AMSI:
7491
WScript.Echo result
7592
```
7693

77-
2. On your Windows Device, open Command Prompt as an administrator.
94+
1. On your Windows Device, open Command Prompt as an administrator.
7895

7996
1. Type `wscript AMSI_vbscript.vbs`, and then press **Enter**.
8097

8198
The result should be as follows:
8299

83-
:::image type="content" source="media/mde-demonstrations-amsi/test-amsi-vbscript-results.png" alt-text="Screenshot showing the AMSI test results. It should show that antivirus software blocked the script." lightbox="media/mde-demonstrations-amsi/test-amsi-vbscript-results.png":::
100+
```vbscript
101+
Windows Script Host
102+
103+
Script: C:\Users\Admin\Desktop\AMSI_vbscript.vbs
104+
105+
Line: 3
106+
107+
Char: 1
108+
109+
Error: This script contains malicious content and has been blocked by your antivirus software.: 'eval'
84110

111+
Code: 800A802D
112+
113+
Source: Microsoft VBScript runtime error
114+
```
85115

86116
### Verifying the test results
87117

88118
In your protection history, you should be able to see the following information:
89119

90-
:::image type="content" source="media/mde-demonstrations-amsi/verifying-results.png" alt-text="Screenshot showing the AMSI test results. The information should show that a threat was blocked and cleaned." lightbox="media/mde-demonstrations-amsi/verifying-results.png":::
120+
```vbscript
121+
Threat blocked
122+
123+
Detected: Virus: Win32/MpTest!amsi
124+
125+
Status: Cleaned
126+
127+
This threat or app was cleaned or quarantined before it became active on your device.
128+
129+
Details: This program is dangerous and replicates by infecting other files.
130+
131+
Affected items:
132+
133+
amsi: \Device\HarddiskVolume3\Windows\System32\WindowsPowershell\v1.0\powershell.exe
134+
135+
or
136+
137+
amsi: C:\Users\Admin\Desktop\AMSI_vbscript.vbs
138+
139+
and/or you might see:
140+
141+
Threat blocked
142+
143+
Detected: Virus: Win32/MpTest!amsi
144+
145+
Status: Cleaned
146+
147+
This threat or app was cleaned or quarantined before it became active on your device.
148+
149+
Details: This program is dangerous and replicates by infecting other files
150+
```
91151

92152
### Get the list of Microsoft Defender Antivirus threats
93153

@@ -101,17 +161,68 @@ You can view detected threats by using the Event log or PowerShell.
101161

102162
3. Look for `event ID 1116`. You should see the following information:
103163

104-
:::image type="content" source="media/mde-demonstrations-amsi/eventid1116.png" alt-text="Screenshot showing Event ID 1116, which says malware or unwanted software was detected." lightbox="media/mde-demonstrations-amsi/eventid1116.png":::
164+
```powershell
165+
166+
Microsoft Defender Antivirus has detected malware or other potentially unwanted software.
167+
168+
For more information please see the following: https://go.microsoft.com/fwlink/?linkid=37020&name=Virus:Win32/MpTest!amsi&t
169+
170+
Name: Virus:Win32/MpTest!amsi
171+
172+
ID: 2147694217
173+
174+
Severity: Severe
175+
176+
Category: Virus
177+
178+
Path: \Device\HarddiskVolume3\Windows\System32\WindowsPowerShell\v1.0\powershell.exe or C:\Users\Admin\Desktop\AMSI_jscri
179+
180+
Detection Origin: Local machine or Unknown
181+
182+
Detection Type: Concrete
183+
184+
Detection Source: System
185+
186+
User: NT AUTHORITY\SYSTEM
105187
106-
##### Use PowerShell
188+
Process Name: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe or C:\Windows\System32\cscript.exe or C:\Windows\Sy
189+
190+
Security intelligence Version: AV: 1.419.221.0, AS: 1.419.221.0, NIS: 1.419.221.0
191+
192+
Engine Version: AM: 1.1.24080.9, NIS: 1.1.24080.9
193+
```
194+
195+
#### Use PowerShell
107196

108197
1. On your device, open PowerShell.
109198

110-
2. Type the following command: `Get-MpThreat`.
199+
1. Type the following command: `Get-MpThreat`.
111200

112201
You might see the following results:
113202

114-
:::image type="content" source="media/mde-demonstrations-amsi/get-mpthreat-results.png" alt-text="Screenshot showing the results of the Get-MpThreat command. It should show that an AMSI threat was detected." lightbox="media/mde-demonstrations-amsi/get-mpthreat-results.png":::
203+
```powershell
204+
CategoryID : 42
205+
206+
DidThreatExecute : True
207+
208+
IsActive : True
209+
210+
Resources :
211+
212+
RollupStatus : 97
213+
214+
SchemaVersion : 1.0.0.0
215+
216+
SeverityID : 5
217+
218+
ThreatID : 2147694217
219+
220+
ThreatName : Virus:Win32/MpTest!amsi
221+
222+
TypeID : 0
223+
224+
PSComputerName :
225+
```
115226
116227
117228
## See also

0 commit comments

Comments
 (0)