Adding All Sites to Office 365 Retention Preservation Policy

slattdog used Ask the Experts™
We are trying to add all "sites" to a preservation policy in Office 365 Retention.  I found this ( regarding how to accomplish it for the mailboxes, and would like to apply the same logic to the site retention if possible.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018
PowerShell is the answer, but even with it the task can be messy. Basically you need to enumerate all sites and get the URLs, then feed them to the New/Set-RetentionCompliancePolicy cmdlet. I've written a detailed post on this here:


Thanks Vasil!  (Great article btw :)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial