PowerShell Commands


Email Server Connectivity Test
Test-NetConnection domain.com -Port 110
Test-NetConnection domain.com -Port 25
Test-NetConnection domain.com -Port 26
Test-NetConnection domain.com -Port 587
Test-NetConnection domain.com -Port 995
Test-NetConnection domain.com -Port 465
Test-NetConnection domain.com -Port 143
Test-NetConnection domain.com -Port 993


Email Server Connectivity Test – All Ports at Once
25,26,110,143,465,587,993,995 | ForEach-Object { [PSCustomObject]@{Port=$_; Status=(Test-NetConnection domain.com -Port $_ -InformationLevel Quiet -WarningAction SilentlyContinue)} }

How to Check the Results?
True – The port is accessible and the connection is successful.
False – The connection failed. The port may be blocked by your ISP, firewall, or network settings, or the server may not be accepting connections on that port.

Domain MX Record
Resolve-DnsName domain.com -Type MX

SPF Record
Resolve-DnsName domain.com -Type TXT

DKIM Record
Resolve-DnsName default._domainkey.domain.com -Type TXT

DMARC Record
Resolve-DnsName _dmarc.domain.com -Type TXT

DNS Records Lookup – All Major Records
‘A’,’AAAA’,’MX’,’NS’,’TXT’ | ForEach-Object { Resolve-DnsName domain.com -Type $_ -ErrorAction SilentlyContinue }; ‘_dmarc.domain.com’,’default._domainkey.domain.com’ | ForEach-Object { Resolve-DnsName $ -Type TXT -ErrorAction SilentlyContinue }

Local Resolver
Resolve-DnsName domain.com -Type A
Resolve-DnsName subdomain.domain.com -Type A


Public Resolver
Resolve-DnsName domain.com -Server 1.1.1.1 -Type A
Resolve-DnsName subdomain.domain.com -Server 1.1.1.1 -Type A

Check TCP HTTPS connection
Test-NetConnection domain.com -Port 443

Check TCP HTTP connection
Test-NetConnection domain.com -Port 80

Check IP address
(Invoke-RestMethod https://api.ipify.org)