I’m trying to create DKIM TXT record through powershell using this command:
Add-DnsServerResourceRecord -Txt -ZoneName <some_zone> -Name <some_name> -DescriptiveText $txt
if the $txt string contains more than 255 character it gives an error like this:
Add-DnsServerResourceRecord : InputObject for resource record has an invalid value.
After many hours of digging I came across this alternative, which involves command outside powershell, and it’s deprecated, along with some other problems:
$cmd = 'dnscmd /recordAdd ’ + $domain_name + ’ ’ + $hostname + ’ txt ’ + $SplittedTxt
$SplittedTxt string here contains multiple texts in quotes like “one” “who” “three”.
My question is, can I do the same with Add-DnsServerResourceRecord command? because no matter what I put there it gives error. How can I use this command to create TXT record with multiple strings in it to avoid single string length limitation?