Manage Office 365 with PowerShell


Hereunder some tips for managing Office 365 with PowerShell :

#Connect to your tenant

#Add your domain 
New-MsolDomain -Name

#Retrieve the TXT informations to create on your DNS zone to prove ownership
Get-MsolDomainVerificationDns -DomainName

#Verify the domain status
Get-MsolDomain -DomainName

#Force Office 365 to verify your domain
Confirm-MsolDomain -DomainName

#Convert to Federated for SSO
Convert-MsolDomainToFederated -DomainName
#Set the user principal name (UPN)
Set-MsolUserPrincipalName -UserPrincipalName admin@ItForDummies.local -NewUserPrincipalName

#Suppress a domain
Remove-MsolDomain -DomainName -Force

#Suppress a user
Remove-MsolUser -UserPrincipalName -Force

#Create a mail contact object
New-MailContact -DisplayName 'It For Dummies' -ExternalEmailAddress '' -Name 'It For Dummies'

You can see the list of available command with :

Get-Command -Module MSOnline

You can use ‘Get-Help‘ on each of them.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.