Firstly, run powershell as Administrator and execute
[powershell]Import-Module DnsClient[/powershell]
After that you can run the Resolve-DnsName cmdlet:
[powershell]
Resolve-DnsName reddit.com
[/powershell]
Which returns:
You can specify which type of record you’re interested in:
[powershell]
Resolve-DnsName -type MX reddit.com
[/powershell]
So, take that logic and add a sprinkle of basic string functions to get:
[powershell]
(-join (Resolve-DnsName -Type MX –Name reddit.com -ea 0).NameExchange).ToLowerInvariant().Contains("google")
[/powershell]
Which returns True/False if any of the MX records contain “google”, which would mean the mail server is Gmail.