36

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, 2010 at 20:38
  • Please see answer by WilfriedVS, which works as a charm Apr 29, 2015 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, 2016 at 15:11

5 Answers 5

63

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! Apr 29, 2015 at 8:48
  • Updated to use this as the answer.
    – Josh
    May 26, 2016 at 17:33
  • This doesn't work for me, but maybe because I'm looking up a .no domain?
    – wogsland
    Oct 12, 2020 at 8:03
19

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, 2016 at 19:01
  • If you type : nslookup /? will see : nslookup [-opt ...] host server # just look up 'host' using 'server'
    – tgkprog
    Apr 4, 2016 at 19:01
7

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

2
  • That only works on Windows Server 2012 R2 and Windows 8.1, question was about Windows 7
    – LJT
    May 26, 2016 at 5:59
  • If you run this internally and want to see external, you can add the -server <remote NS IP> to get external records similar to how nslookup command with the lserver works e.g. Resolve-DnsName villagevines.com -Type TXT -Server 8.8.8.8. Thank you for this answer +1. Aug 4, 2022 at 14:17
6

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .