33

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?

Josh
  • 611
  • 2
  • 6
  • 15

5 Answers5

60

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

>
Oliver Salzburg
  • 4,505
  • 16
  • 53
  • 80
WilfriedVS
  • 856
  • 6
  • 3
17

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.

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

Jan
  • 171
  • 1
  • 1
  • That only works on Windows Server 2012 R2 and Windows 8.1, question was about Windows 7 – LJT May 26 '16 at 05:59
  • If you run this internally and want to see external, you can add the `-server ` 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. – Pimp Juice IT Aug 04 '22 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 
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
squillman
  • 37,618
  • 10
  • 90
  • 145