kennysarmy Posted December 13, 2023 Posted December 13, 2023 Hi, I've finally successfully got my retention policies working for staff, they either have a 14 month or 3 year retention on emails depending on their role. I cannot work out though how to export a list of which mailbox get's which policy so I can send this to our deputy head for checking to make sure we've a) not missed someone out or b) put the wrong policy against someone. The root to the policies is via the Microsoft Purview portal. https://compliance.microsoft.com/homepage Then Data lifecycle management on the left hand side menu; Microsoft 365 then retention policies! I cannot find anything online to export the mailbox list via the GUI or PowerShell. Anyone any ideas? Clicking Edit just brings up the dialog box for selecting accounts - no option to export the list :/
EssentialRug Posted December 13, 2023 Posted December 13, 2023 Hi, I've finally successfully got my retention policies working for staff, they either have a 14 month or 3 year retention on emails depending on their role. I cannot work out though how to export a list of which mailbox get's which policy so I can send this to our deputy head for checking to make sure we've a) not missed someone out or b) put the wrong policy against someone. The root to the policies is via the Microsoft Purview portal. https://compliance.microsoft.com/homepage Then Data lifecycle management on the left hand side menu; Microsoft 365 then retention policies! I cannot find anything online to export the mailbox list via the GUI or PowerShell. Anyone any ideas? [ATTACH=CONFIG]70475[/ATTACH] Clicking Edit just brings up the dialog box for selecting accounts - no option to export the list :/ Is this what you're looking for? https://community.spiceworks.com/topic/2022402-need-to-get-a-list-of-users-and-the-email-retention-policy-assigned-to-them
kennysarmy Posted December 13, 2023 Author Posted December 13, 2023 Is this what you're looking for? https://community.spiceworks.com/topic/2022402-need-to-get-a-list-of-users-and-the-email-retention-policy-assigned-to-them Sadly not. This lists the retention policy that you'd get from here: Which is different to the ones I require.
paulkerton Posted December 13, 2023 Posted December 13, 2023 Hi, I've finally successfully got my retention policies working for staff, they either have a 14 month or 3 year retention on emails depending on their role. I have to ask, how did you approach this from a cultural change and shift approach? Many people treat their email as a file store, we need to get that culture shifted.
EssentialRug Posted December 13, 2023 Posted December 13, 2023 Sadly not. This lists the retention policy that you'd get from here: [ATTACH=CONFIG]70477[/ATTACH] Which is different to the ones I require. After spending an obscene amount of time on this I think I've managed to get it working using the attached powershell script. Just make sure to add your global admin details at the start of the script to connect to the security and compliance powershell and the exchange online powershell. Do let me know if all working for you. ReturnMailboxesRetentionCompliance.ps1
kennysarmy Posted December 14, 2023 Author Posted December 14, 2023 After spending an obscene amount of time on this I think I've managed to get it working using the attached powershell script. Just make sure to add your global admin details at the start of the script to connect to the security and compliance powershell and the exchange online powershell. Do let me know if all working for you. [ATTACH]70480[/ATTACH] Thanks Will give it a whirl later today and report back.
kennysarmy Posted December 14, 2023 Author Posted December 14, 2023 After spending an obscene amount of time on this I think I've managed to get it working using the attached powershell script. Just make sure to add your global admin details at the start of the script to connect to the security and compliance powershell and the exchange online powershell. Do let me know if all working for you. [ATTACH]70480[/ATTACH] Well it almost works We have two retention policies: 14 month retention policy (with 226 mailboxes allocated) & 36 month retention policy (with 42 mailboxes allocated) The script runs and the output has 2037 lines. There are no lines detailing anyone having the 14 month policy Everyone in the tenancy is being detailed as having the 36 month retention policy
kennysarmy Posted December 14, 2023 Author Posted December 14, 2023 Well it almost works We have two retention policies: 14 month retention policy (with 226 mailboxes allocated) & 36 month retention policy (with 42 mailboxes allocated) The script runs and the output has 2037 lines. There are no lines detailing anyone having the 14 month policy Everyone in the tenancy is being detailed as having the 36 month retention policy Is there a PowerShell command to just check one user's retention policy?
EssentialRug Posted December 14, 2023 Posted December 14, 2023 Well it almost works We have two retention policies: 14 month retention policy (with 226 mailboxes allocated) & 36 month retention policy (with 42 mailboxes allocated) The script runs and the output has 2037 lines. There are no lines detailing anyone having the 14 month policy Everyone in the tenancy is being detailed as having the 36 month retention policy Shoot. Have you recently applied the policies? It can take a week for the correct policies to get to the correct mailboxes...
EssentialRug Posted December 14, 2023 Posted December 14, 2023 You could always use the policy lookup tool to check by user? 1
kennysarmy Posted December 14, 2023 Author Posted December 14, 2023 Shoot. Have you recently applied the policies? It can take a week for the correct policies to get to the correct mailboxes... A few last week and the majority on Tuesday. Just odd that even the students are being tagged against one of the policies, when they definitely aren't included! Thanks for trying. The policy checker might be useful.
kennysarmy Posted October 2, 2025 Author Posted October 2, 2025 For anyone else wondering this works: Connect-IPPSSession then.... Get-RetentionCompliancePolicy -Identity "<POLICY NAME>" -DistributionDetail | Select-Object -ExpandProperty ExchangeLocation
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now