Public/Curanet/Remove-CuraDNSRecord.ps1

function Remove-CuraDNSRecord {
    <#
        .SYNOPSIS
            Command to remove a DNS record with a given ID
 
        .PARAMETER DomainName
            String containing domainname
 
        .PARAMETER ID
            Integer containing the ID of the record needed to be removed.
 
        .OUTPUTS
           $true on success, $false on error
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory)]
        [string]
        $DomainName,

        [Parameter(Mandatory)]
        [int]
        $ID
    )

    $Existing = Get-CuraDNSRecords -DomainName $DomainName | Where-Object id -eq $ID

    if ( $Existing ) {

        $result = Invoke-CuraDNSRequest -Uri "Domains/$($DomainName)/Records/$($ID)" -Method "DELETE"

        if($result) {
            return $true
        }

        else {
            return $false
        }
    }

    return $false
}