Hello,
I'm currently writing scripts to manage our public DNS Server but i'm now blocking on a script to delete mx record.
let's say i have a domain contoso.com
i have 2 mx Records for contoso.com
one with preference 10 pointing on mail1.contoso.com
and one with preference 20 pointing on mail2.contoso.com
if i use this command line :
Remove-DnsServerResourceRecord -ZoneName "contoso.com" -RRType "MX" -Name "@" -Force
i can delete the two MX records at once
But i would like to be able to choose witch MX Record i want to delete.
i tried this command to delete the second MX record:
Remove-DnsServerResourceRecord -ZoneName "contoso.com" -RRType "MX" -Name "@" -RecordData "mail2.contoso.com" -Force
but it ends with an error
InputObject for resource record has an invalid value. Failed to remove the resource record on dns1.contoso.com server. Please check extended error for additional details. + CategoryInfo : InvalidData: (dns1.contoso.com:root/Microsoft/...rResourceRecord) [Remove-DnsServerResourceRecord], CimException + FullyQualifiedErrorId : WIN32 13,Remove-DnsServerResourceRecord + PSComputerName : 10.0.0.10
has anyone an idea that could help ?
Thank you
StephaneDe