PowerShell 3: Add Multi-line TXT Record to DNS

This had me stumped for about 30 minutes, until I finally worked out the correct syntax to make this all work.

I was looking for a way to create a TXT record on my DNS server. The data though is a multi-line record – and had to be multi-line for the server to understand the response. Single line are easy – but the multi-line really threw me.

The trick is rn – this inserts a carriage return and line feed into the string. I was using a apostrophe at first and wondering why it wasn’t working. It isn’t, it is a grave accent, ASCII 96.

So, as an example:

This gives you a record that looks like this in Windows DNS.


It would appear at theĀ minute that this command limits the length of the DescriptiveText parameter to 255 charactors. This is maximum string length, per line. PowerShell interprets this as the maximum length overall though.

1 person found this post useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.