Limiting Library Version Storage across your SharePoint farm

There are situations where documents are frequently edited. Each edit creates a new version in SharePoint. In SP2010, each version consumed the full disk space, with no optimization for managing deltas. In SP2013, one of the benefits of Shredded Storage is that it optimizes storage usage for multiple similar versions of not just Office XML (Office 2010/2013) documents but also other filetypes like PDFs and image files. It does this by working out and storing only the file differentials. Even with Shredded Storage, you can limit the number of versions retained on document edits. Here’s how to do this across your farm. Let’s limit major versions to three, and minor versions to five:

$spWebApp = Get-SPWebApplication http ://SharePoint
for ($Si=0; $Si -lt $spWebApp.Sites.count; $Si++)
{
$site = $spWebApp.Sites[$Si];
for ($Wi=0; $Wi -lt $site.AllWebs.count; $Wi++)
{
$web = $site.AllWebs[$Wi];
for ($Li=0; $Li -lt $web.Lists.count; $Li++)
{
$List = $web.Lists[$Li];
if ($list.EnableVersioning)
{
$list.MajorVersionLimit = 3
}
if ($list.EnableMinorVersions)
{
$list.MajorWithMinorVersionsLimit = 5
}
$list.Update()
}
$web.dispose()
}
$site.dispose()
}
$spWebApp.dispose()
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *