[Script Of Sep. 28] How to remove a custom domain from Office 365
The script is available for download from http://gallery.technet.microsoft.com/How-to-remove-a-custom-6fe91693. You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.
This script will remove a custom domain from Office 365.
This script will remove a custom domain from Office 365 when there is an error message "Remove-MsolDomain : Unable to remove this domain. Use Get-MsolUser -DomainName to retrieve a list of objects that are blocking removal."
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery