Courseiva
Prepare infrastructure for deviceshardMultiple ChoiceObjective-mapped

MD-102 Prepare infrastructure for devices Practice Question

Exhibit

Refer to the exhibit.

$devices = Get-MgDeviceManagementManagedDevice -Filter "operatingSystem eq 'Windows'"
foreach ($device in $devices) {
    if ($device.ComplianceState -ne 'compliant') {
        Invoke-MgDeviceManagementManagedDevice -ManagedDeviceId $device.Id -Action wipe
    }
}

Refer to the exhibit. You execute this PowerShell script to wipe noncompliant Windows devices. After running, you find that some compliant devices were also wiped. What is the most likely reason?

⚠ Common exam trap

Test-takers frequently assume the script logic is correct and focus on the compliance filter, but the real issue is the Graph API endpoint, which is a common misconfiguration that causes unintended mass actions.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

The script uses the wrong Graph API endpoint, causing all devices to be wiped.

The script uses the wrong Graph API endpoint. The correct endpoint for wiping a device is `/deviceManagement/managedDevices/{deviceId}/wipe`, but the script likely uses an incorrect or generic endpoint (e.g., `/devices/{deviceId}/wipe` or a non-existent path), which causes the API to misinterpret the request or apply the wipe action to all devices in the tenant, including compliant ones. This is a common misconfiguration when targeting the Microsoft Graph API for Intune device actions.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • The filter 'operatingSystem eq 'Windows'' does not match any devices, so the script wiped all devices.

    Why it's wrong here

    The filter is correct for Windows devices.

  • The script wipes only noncompliant devices, but some compliant devices had a null compliance state.

    Why it's wrong here

    A null compliance state would be treated as noncompliant, but compliant devices should have a state of 'compliant'.

  • The script uses the wrong Graph API endpoint, causing all devices to be wiped.

    Why this is correct

    The cmdlet Invoke-MgDeviceManagementManagedDevice does not exist; the correct cmdlet is Invoke-MgDeviceManagementManagedDeviceAction with proper parameters. The incorrect cmdlet might have unexpected behavior or default to wiping all devices.

  • The script does not check the device's compliance state before wiping.

    Why it's wrong here

    The script does check with the if condition.

About these practice questions

This MD-102 question is part of Courseiva's 942-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This MD-102 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the MD-102 exam.