In this series I occasionally (yes, too occasionally) writing about small useful advices, which are answers for my colleagues, students and sometimes customers. I know that many of this kind advices are well known for many of technical blog readers, but from my perspective it’s very helpful for me. Why? Sometimes I need solution on demand and sometimes I don’t remember how something simple do. But I remember: “Wait, bastard! You wrote about it on blog!” Now I’m writing about Site Collection Versioning in SharePoint 2013.
One of my client asked me about enabling versioning for brand new SharePoint 2013 farm with few separate site collections, and sites, lists, libraries inside. First point for solve this request is going to Central Administration… where I spend half an hour to find simple answer: how to enable versioning on ALL site collections. And the answer is simple – this feature is not working on Farm Level, just on Site Collection level. That means: If I have four, five, ten Site Collections – I need to enable versioning on all site collection manually separately. Does not make sense and it’s really boring.
But… I have Power! I can use PowerShell with one simple script for enabling versioning on all my site collections and libraries and list if I need. The original post has been written by Keith Tuomi (Canadian SharePoint MVP) here, but is worth to be partially quoted and re-discover.
Pict.1 Whole script for enabling versioning on all site collections.
If I need I can enabling versioning with Major and Minor levels fon all Document Libraries on my SharePoint Farm (in this example 5 major and 10 Minor versions). Script have two parameters:
1. Required: Site collection URL e.g. http://intranet.company.com (specifies the site collection to operate on)
Example 1 – run the script in report mode only (no changes effected):
c:sharepointadminaccount.Enable-Versioning.ps1 http://intranet.company.com
2. Optional: execute Script runs in report mode only unless you add the word execute
Example 2 – run the script in execute mode:
c:sharepointadminaccount.Enable-Versioning.ps1 http://intranet.company.com execute
Easy? Yes! And it works. As additional advice – it’s possible to add this script for Windows Task manager for run on regular basis to be shure that all new site collection, site, library, list are versioning. Script you can downolad from resources page.