Is there a limitation on the Powershell command Get-RetentionCompliancePolicy?

Alexander Andro Jae Diaz 40 Reputation points
2025-06-17T02:06:54.5833333+00:00

I tried managing retention policies via Powershell for automation but when I came across the command Get-RetentionCompliancePolicy but it does not say what location are either enabled and disabled whenever I tried disabling/enabling the locations. For example in the UI I have set the exchange location to disable but when I use the command Get-RetentionCompliancePolicy there is no indication or property indicating that the exchange location was disabled. Need help on what could be the problem? See screen shots below:

UI
User's image

Powershell

image1

image2

for the workload above - the values do not change.

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Finn Dang 455 Reputation points Independent Advisor
    2025-06-18T15:44:23.69+00:00

    Hello Alexander Andro Jae Diaz,

    Wishing you a good day!

    Get-RetentionCompliancePolicy shows summary values unless you tell it to pull the distribution details. Microsoft’s own help says that without the extra switch *“the values of the DistributionStatus and Location property values will be inaccurate.” For more information, please visit this link.

    Because of that, every Location and LocationException property comes back as an empty hash table {}, even when the policy clearly targets (or excludes) something in the UI.

    What to run instead

    Get-RetentionCompliancePolicy -Identity "My Policy Name" -DistributionDetail |
        Format-List Name, ExchangeLocation*, SharePointLocation*, OneDriveLocation*, \
                    ModernGroupLocation*, SkypeLocation*
    

    With the switch you’ll now see:

    • ExchangeLocation = {All} or a list of mailboxes when Exchange is ON
    • ExchangeLocation = {} when Exchange is OFF (exactly what the toggle in the UI does)
    • Any *LocationException values if you excluded specific objects.

    If you want rule-level detail (for example to inspect retention action, duration, etc.), follow up with:

    Get-RetentionComplianceRule -Policy "My Policy Name" -DistributionDetail | fl
    

    Is there any real limitation?

    Location count – a static retention policy can contain up to 1000 Exchange mailboxes and 1000 OneDrive accounts. If you need more, split the scope across multiple policies or use an adaptive scope.

    Otherwise, the cmdlet surfaces everything the UI does; you just have to remember the -DistributionDetail switch.

    So the empty {} you’re seeing isn’t a bug, just the “quick” output. I hope this helps.

    Best regards,

    Finn Dang

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.