top of page

PowerShell Enable Versioning in all Site Collection Lists & Libraries

  1. Use your own library template (with versioning turned on)

  2. Use feature + event handler to programmatically activate versioning on each new list The easiest way out of those two options is probably to use your own template. To do this, create a new document library, activate versioning, then save this list as template. When you create a new list, you will then be able to use your template and directly create a list with versioning activated. What about cases where we don't want to/can't use templates and we have admins spinning up new lists/libraries and jonesing for that versioning goodness? The following PowerShell can be used to report on, and optionally enable Versioning on all Lists and Libraries in the site collection URL it is fed. Minor Versioning, and Major/Minor Version quantity limit toggling is also in there but commented out. To turn on those options, simply remove the # symbol from the beginning of the lines.

PowerShell Script (save as file e.g. Enable-Versioning.ps1):

Usage:

Script takes two parameters: 1. Required: Site collection URL e.g. http://mysitecollection Specifies the site collection to operate on.

2. Optional: execute Script runs in report mode only unless you add the word execute

Example 1: Run the script in report mode only (no changes effected):

    c:usersadministratordesktop.Enable-Versioning.ps1 http://mysitecollection

Example 2: Run the script in execute mode:  c:usersadministratordesktop.Enable-Versioning.ps1 http://mysitecollection execute This script could potentially be run on an automated basis via the Windows Task Scheduler - this would let you run it on a regular basis to ensure all lists/libraries in a site collection have Versioning turned on.

4 views0 comments

Recent Posts

See All

Archetonomy Mega Drop Down Review

The Mega menus concept Now, mega menus are probably well familiar to anyone and everyone by now- it was an up and coming design trend back in the late 2000's. Old hat - but let's review the fundamenta

Comments


bottom of page