To distribute a certificate in Intunes, OMA-URI you need the ThumbPrint and the raw certificate, i.e. the «Base-64 encoded X.509 (.CER)» export. This query removes all the CR LF as wel as the "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----".

$folderPath = "C:\test"
$fileExtension = ".cer"

# Get all files with the specified file extension in the folder
$files = Get-ChildItem -Path $folderPath -File | Where-Object {$_.Extension -eq $fileExtension}

# Iterate through each file
foreach ($file in $files) {
    $content = Get-Content -Path $file.FullName -Raw

    # Remove CR and LF characters from the content
    $content = $content -replace "[\r\n]"

    # Remove "-----BEGIN CERTIFICATE-----" and "-----END CERTIFICATE-----" lines
    $content = $content -replace "-----BEGIN CERTIFICATE-----",""
    $content = $content -replace "-----END CERTIFICATE-----",""

    # Append "_mod_4_intunes" to the filename
    $newFileName = $file.BaseName + "_mod_4_intunes" + $file.Extension

    # Create the new file with modified content and updated filename
    $newFilePath = Join-Path -Path $folderPath -ChildPath $newFileName
    $content | Set-Content -Path $newFilePath -Encoding UTF8

    # Remove the original file
    #Remove-Item -Path $file.FullName
}