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