When an employee leaves your company, you will most likely disable their Office 365 user account but leave their mailbox around. It is also incredibly likely that this employee is the member of one of more Distribution Groups.
The last thing you want is for this person’s mailbox to fill up with emails sent to a group, so you need to make sure that you have a process to remove disabled user accounts from any distribution groups they may have been a member of.
We’ve created a script which you can download and run against your Office 365 environment. It will create a CSV file listing all disabled user accounts in your Office 365 environment that are still members of a group.