The Get-MsolDomain cmdlet in PowerShell gets a domain in Microsoft Office 365.
The syntax to get a company domain in Azure Active Directory is given below.
Get-MsolDomain [-Status <DomainStatus>] -DomainName <String> [-Authentication <DomainAuthenticationType>] [-Capability <DomainCapabilities>] [-TenantId <Guid>] [<CommonParameters>]
In this article, we will discuss how to get all domains for the company, get a domain by name, and find verified domains in the Azure Active Directory with PowerShell.
How to Get All Domains for the Company in Office 365
To get all domains for the company in Office 365, use the Get-MsolDomain cmdlet.
This command retrieves all domains for the company including verified and unverified domains.
How to Get a Domain By Name
To get a domain by name, use the Get-MsolDomain command with the
-DomainName parameter. The
-DomainName parameter specifies the fully qualified domain name to retrieve.
Get-MsolDomain -DomainName "shellgeek.com"
This command retrieves the shellgeek.com domain.
How to Get a Verified Domain Name in Office 365
To get a verified domain name in Office 365, use the Get-MsolDomain cmdlet with
-Status parameter. The
-Status parameter specifies the filter to return only domains with the specified status. Valid values are: Verified, Unverified, and PendindDeletion.
Get-MsolDomain -Status Verified
This command returns a list of verified company domains.
I hope the above article on how to use the Get-MsolDomain command in PowerShell to get domains in Office 365 is helpful to you.
You can find more topics about PowerShell Active Directory commands and PowerShell basics on the ShellGeek home page.