Skip to content

Commit 68c4d8b

Browse files
authored
Merge pull request #266710 from amitronen1/docs-editor/enable-agentless-scanning-vms-1708435938
Update enable-agentless-scanning-vms.md
2 parents bd72ace + 2f1eeb1 commit 68c4d8b

File tree

1 file changed

+29
-44
lines changed

1 file changed

+29
-44
lines changed

articles/defender-for-cloud/enable-agentless-scanning-vms.md

Lines changed: 29 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -167,51 +167,36 @@ The alert `MDC_Test_File malware was detected (Agentless)` will appear within 24
167167

168168
1. Execute the following script.
169169

170-
```powershell
171-
# virus test string
172170

173-
$TEST_STRING = '$$89-barbados-dublin-damascus-notice-pulled-natural-31$$'
174-
175-
176-
177-
# File to be created
178-
179-
$FILE_PATH = "C:\temp\virus_test_file.txt"
180-
181-
182-
183-
# Write the test string to the file without a trailing newline
184-
185-
[IO.File]::WriteAllText($FILE_PATH, $TEST_STRING)
186-
187-
188-
189-
# Check if the file was created and contains the correct string
190-
191-
if (Test-Path -Path $FILE_PATH) {
192-
193-
$content = [IO.File]::ReadAllText($FILE_PATH)
194-
195-
if ($content -eq $TEST_STRING) {
196-
197-
Write-Host "Test file created and validated successfully."
198-
199-
}
200-
201-
else {
202-
203-
Write-Host "Test file does not contain the correct string."
204-
205-
}
206-
207-
}
208-
209-
else {
210-
211-
Write-Host "Failed to create test file."
212-
213-
}
214-
```
171+
```powershell
172+
# Virus test string
173+
$TEST_STRING = '$$89-barbados-dublin-damascus-notice-pulled-natural-31$$'
174+
 
175+
# File to be created
176+
$FILE_PATH = "C:\temp\virus_test_file.txt"
177+
 
178+
# Create "temp" directory if it does not exist
179+
$DIR_PATH = "C:\temp"
180+
if (!(Test-Path -Path $DIR_PATH)) {
181+
    New-Item -ItemType Directory -Path $DIR_PATH
182+
}
183+
 
184+
# Write the test string to the file without a trailing newline
185+
[IO.File]::WriteAllText($FILE_PATH, $TEST_STRING)
186+
 
187+
# Check if the file was created and contains the correct string
188+
if (Test-Path -Path $FILE_PATH) {
189+
    $content = [IO.File]::ReadAllText($FILE_PATH)
190+
    if ($content -eq $TEST_STRING) {
191+
        Write-Host "Test file created and validated successfully."
192+
    } else {
193+
        Write-Host "Test file does not contain the correct string."
194+
    }
195+
} else {
196+
    Write-Host "Failed to create test file."
197+
}
198+
```
199+
215200
216201
The alert `MDC_Test_File malware was detected (Agentless)` will appear within 24 hours in the Defender for Cloud Alerts page and in the Defender XDR portal.
217202

0 commit comments

Comments
 (0)