30

I want to inspect TXT records for my domain, such as SPF records. I tried the following command with nslookup but it didn't list the TXT records:

nslookup -type=TXT example.com

What is the correct command, or is there a better tool use on Windows 7?

3
  • 2
    The command above works but villagevines.com has no TXT records however www.villagevines.com does. – user9517 Aug 24 '10 at 20:38
  • Please see answer by WilfriedVS, which works as a charm – lucaferrario Apr 29 '15 at 8:49
  • 2
    Not sure if this parameter available on Windows 7, but on Windows 10 nslookup -q=txt example.com works for me. – Jedidja Oct 31 '16 at 15:11
55

First start nslookup without parameters, then type set type=txt, then type the domain name.

nslookup <enter>
set type=txt <enter>
villagevines.com

Example

C:\Users\wilfried>nslookup

Default Server:  mydnsserver
Address:  192.168.1.1

> set type=txt

> villagevines.com

Server:  mydnsserver

Address:  192.168.1.1

*** No text (TXT) records available for villagevines.com

>
3
  • 2
    This is the real answer to the question and should be marked as such! – lucaferrario Apr 29 '15 at 8:48
  • Updated to use this as the answer. – Josh May 26 '16 at 17:33
  • This doesn't work for me, but maybe because I'm looking up a .no domain? – wogsland Oct 12 '20 at 8:03
16

I have no ideea why but if you add an IP of a nameser at the end it will work.
I have added google's dns name in this case:

nslookup -type=TXT villagevines.com 8.8.8.8

It can be your local DNS service.

HTH next time when you need to query your TXT records.

2
  • The last parameter is the DNS to use. Maybe the default is to use the ISPs and that DNS is caching old data. This might work soon after a DNS TXT record change. – tgkprog Apr 4 '16 at 19:01
  • If you type : nslookup /? will see : nslookup [-opt ...] host server # just look up 'host' using 'server' – tgkprog Apr 4 '16 at 19:01
5

Download BIND for Windows, there is a Windows port of dig in that. You should use dig instead of nslookup.

If you're a Powershell fan (like me) you can also download the Powershell Dig Cmdlet which should get TXT records for you directly within powershell. Good stuff.

PS> Get-Dns -Name mydomain.com -Type TXT
5

The link for Get-Dns does not work, the standard Powershell cmdlet to do this is

PS> Resolve-DnsName villagevines.com -Type TXT

See more on Resolve-DnsName

1
  • That only works on Windows Server 2012 R2 and Windows 8.1, question was about Windows 7 – LJT May 26 '16 at 5:59
5

In Windows 10, this work:

nslookup -q=TXT villagevines.com 

Update: At this moment 2021-03-29, in Windows 10, you can use old nslookup syntax

nslookup -type=TXT villagevines.com 
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.