Manage Office 365 with PowerShell

Hello,

Hereunder some tips for managing Office 365 with PowerShell :

#Connect to your tenant
Connect-MsolService

#Add your domain 
New-MsolDomain -Name ItForDummies.net

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

#Verify the domain status
Get-MsolDomain -DomainName ItForDummies.net

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

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

#Suppress a domain
Remove-MsolDomain -DomainName ItForDummies.net -Force

#Suppress a user
Remove-MsolUser -UserPrincipalName guest@ItForDummies.net -Force

#Create a mail contact object
New-MailContact -DisplayName 'It For Dummies' -ExternalEmailAddress 'admin@ItForDummies.net' -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.