functions/Mde/machines/Set-MdMachineStopandquarantinefile.ps1

function Set-MdMachineStopandquarantinefile {
<#
.SYNOPSIS
    Actions - Stop and quarantine a file
 
.DESCRIPTION
    Stop execution of a file on a machine and delete it.
 
.PARAMETER Comment
    A comment to associate to the restriction removal
 
.PARAMETER MachineID
    The ID of the machine to unrestrict
 
.EXAMPLE
    PS C:\> Set-MdMachineStopandquarantinefile -Comment $comment -MachineID $machineid
 
    Stop execution of a file on a machine and delete it.
 
.LINK
    <unknown>
#>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseShouldProcessForStateChangingFunctions', '')]
    [CmdletBinding(DefaultParameterSetName = 'default')]
    param (
        [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'default')]
        [string]
        $Comment,

        [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true, ParameterSetName = 'default')]
        [Alias('Id')]
        [string]
        $MachineID
    )
    process {
        $__mapping = @{
            'Comment' = 'Comment'
        }

        $__param = @{
            Body = $PSBoundParameters | ConvertTo-HashTable -Include @('Comment') -Mapping $__mapping
            Query = $PSBoundParameters | ConvertTo-HashTable -Include @() -Mapping $__mapping
            Header = $PSBoundParameters | ConvertTo-HashTable -Include @() -Mapping $__mapping
            Path = 'machines/{MachineID}/StopAndQuarantineFile' -Replace '{MachineID}',$MachineID
            Method = 'post'
            
            Service = 'DefenderAPI.Endpoint'
        }
        
        $__param += $PSBoundParameters | ConvertTo-HashTable -Include 'ErrorAction', 'WarningAction', 'Verbose'

        try { Invoke-EntraRequest @__param }
        catch { $PSCmdlet.ThrowTerminatingError($_) }
    }
}