The script is available for download from https://gallery.technet.microsoft.com//How-to-remove-an-SMTP-8a8d0cfe. 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 sample is used to remove an SMTP domain from Office 365.
This script sample is used to remove an SMTP domain from Office 365. The address which uses the domain as suffix in mailboxes and distribution groups will be removed.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery