GithubHelp home page GithubHelp logo

rhymeswithmogul / office365dnschecker Goto Github PK

View Code? Open in Web Editor NEW
10.0 1.0 1.0 511 KB

A PowerShell module to verify that your Office 365 DNS records have been set up correctly.

Home Page: https://powershellgallery.com/packages/Office365DnsChecker

License: GNU General Public License v3.0

PowerShell 100.00%
powershell exchange-online dkim office365 office-365 microsoft-teams skype-for-business azure-active-directory spf spf-record senderid sender-policy-framework sip autodiscover autodiscover-service pwsh cmdlet cmdlets 365lookup dns-records

office365dnschecker's Introduction

PowerShell Gallery Version (including pre-releases) PowerShell Gallery

Office365DnsChecker

Office365DnsChecker will check one or more domains, to make sure that their current DNS records are set up correctly and completely for Office 365.

Office365DnsChecker logo

System Requirements

This module requires Windows PowerShell 5.1 or greater. It works great on PowerShell 7, and supports constrained language mode.

Additionally, Linux users will need to install the app dig (part of bind-utils). It is installed by default on macOS (at least in High Sierra).

Installation

You can clone this repository and put it in your $PSModulePath, or grab it from PSGallery:

Install-Module -Name Office365DnsChecker

Usage

You can check all applicable Office 365 DNS records at once with the cmdlet Test-Office365DnsRecords:

PS C:\> Test-Office365DnsRecords "contoso.com"

These cmdlets also accept pipeline input. If you're logged into Exchange Online, use the following command to test all of your organization's domains.

PS C:\> Get-AcceptedDomain | Test-Office365DnsRecords

Advanced Usage

You can also check individual services:

  • Test-EntraIDRecords
  • Test-ExchangeOnlineRecords
  • Test-TeamsRecords (or Test-SkypeForBusinessOnlineRecords)

Or, you can even check individual DNS records:

  • Test-EntraIDClientConfigurationRecord to check the msoid CNAME.
  • Test-EntraIDEnterpriseEnrollmentRecord to check the enterpriseenrollment CNAME.
  • Test-EntraIDEnterpriseRegistrationRecord to check the enterpriseregistration CNAME.
  • Test-ExchangeOnlineAutodiscoverRecord to check both the existence of the autodiscover CNAME, and the non-existence of _autodiscover._tcp SRV records.
  • Test-ExchangeOnlineDkimRecords to check the selector1 and selector2 DKIM records.
  • Test-ExchangeOnlineMxRecord to check the domain's MX record(s) and whether or not they support DANE.
  • Test-ExchangeOnlineSenderIdRecord to check the domain's Sender ID record, if present.
  • Test-ExchangeOnlineSpfRecord to check the domain's SPF TXT record.
  • Test-TeamsAutodiscoverRecord to check the lyncdiscover CNAME.
  • Test-TeamsSipCnameRecord to check the sip CNAME.
  • Test-TeamsSipSrvRecord to check the _sip._tls SRV record(s).
  • Test-TeamsSipFederationSrvRecord to check the _sipfederationtls._tcp SRV record(s).

Identifying problems

When you run one of this module's commands, the corresponding DNS records are retrieved and evaluated. In case of an incorrect record, a warning or an error may be printed to the screen, telling you which records are wrong or missing.

If an error is printed, you can retrieve the error object through the $error automatic variable, just like PowerShell supports normally:

$error[0].ErrorDetails

Getting help for resolving problems

In addition, basic steps to resolving the error may be available through the information pipeline. You can make this information visible by regular means such as specifying -InformationAction Continue, setting $InformationPreference, or redirecting the information pipeline (six). This information is also available in the error object's details.

# this works.
Test-Office365DnsRecords "contoso.com" -InformationAction Continue

# this also works.
Test-Office365DnsRecords "contoso.com" 6> howtofixcontoso.txt

# this works, too.
$error[0].ErrorDetails.RecommendedAction

While the included one- or two-sentence tips may be useful for giving Office 365 administrators some idea on how to fix any DNS problems, you should still consult the Microsoft 365 Admin Center's Domains page, which will tell you all but exactly how to fix your DNS records in common scenarios.

In some cases, DNS records may intentionally be incorrect -- for example, if you have a third-party spam filter sitting in front of Exchange Online that requires custom MX records; or, if you have an on-premises Skype for Business Server that requires your Teams-/Skype-related DNS CNAME records to be incorrect intentionally. Please consult your IT department or your local MCSE to make sure that following this module's generic advice won't interrupt your company's operations.

office365dnschecker's People

Contributors

rhymeswithmogul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

365xmvp

office365dnschecker's Issues

Feature request - Use Google DNS API for looking up DNS records

Using Google DNS API for looking up DNS records might help speed up the code, plus it will truly be multi platform.

Example

## Domain
$Domain = '<some_domain>'

## Uri
### All
$Uri = 'https://dns.google.com/resolve?name={0}&type=all' -f $Domain
### A
$Uri = 'https://dns.google.com/resolve?name={0}&type=a' -f $Domain
### MX
$Uri = 'https://dns.google.com/resolve?name={0}&type=mx' -f $Domain
### TXT
$Uri = 'https://dns.google.com/resolve?name={0}&type=txt' -f $Domain

## Request
(Invoke-RestMethod -Uri $URI -Method 'Get').'Answer'

## AIO SPF
([array]((Invoke-RestMethod -Uri ('https://dns.google.com/resolve?name={0}&type=txt' -f $Domain) -Method 'Get').'Answer'.Where{$_.'data' -like '"v=spf1*'})).'Count' -gt 0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.