How many versions of a typical document do you need to keep? 5? 10? 100?

SharePoint content databases often get cluttered with redundant versions of the same documents. In some cases, I’ve seen presentation libraries with less than 10 GB of active content, but hundreds of GBs of content due to gradual changes.

If you’re ready to clear out old versions, SharePoint’s Management Shell makes it easy. The script below will iterate through all lists and update them to keep only the last 2 copies. It will also loop through and delete unneeded versions.

Get–SPWebApplication | Get–SPSite –Limit All | Get–SPWeb –Limit All | ForEach–Object { ForEach ($list in $_.Lists) { If ($list.EnableVersioning –eq $true){ $list.MajorVersionLimit=2; $list.Update(); ForEach ($item in $list.Items){ $item.URL; $item.SystemUpdate() } } } }

You can see that it…

  1. Loops through all web applications
  2. Loops through their site collections
  3. Loops through their webs
  4. Loops through their lists
  5. If versioning’s enabled, it sets the major version limit to 2
  6. In order to remove old versions, it needs to loop through each item and perform a system update

The script can be easily amended to deal with only specific site collections / libraries. To keep a different number of versions, modify the MajorVersionLimit variable above.

I love Sonos for controlling music in my house.  I was recently confused because a new laptop couldn’t locate my network when running the software configuration wizard.

It turned out that it was trying to use the wrong network interface.  VMWare Workstation adds a “Virtual Ethernet Adapter” for each physical adapter you have.  In the off chance your wizard won’t connect, temporarily disabling the virtual adapters should do the trick.

I just added a new project to CodePlex:

.NET Proxy consists of two components: an ASPX page for proxying requests to other servers and a Javascript class for issuing cross-domain requests using the same syntax as XMLHttpRequest.  I see it being useful for two scenarios:

SSL Proxy


Requests for would become requests for netproxy.aspx?

Javascript Proxy

Another common goal is to incorporate content from third-party sites, but Javascript has a “same origin policy” restriction meaning you can only access files on your own domain. With this proxy, you can GET content from or POST content to any server in the world using the familiar XMLHttpRequest syntax. All methods and properties are wrapped, meaning only the object declaration needs to be changed.


// Pass in the URL for our proxy ASPX page
var bingProxy = new netProxy("netProxy.aspx");
bingProxy.onreadystatechange = function() {
if (bingProxy.readyState == 4)
alert('Source code for\r\n\r\n' + bingProxy.responseText);
}"GET", "", true);

It’s released under the MIT License, meaning you can do pretty much anything you want with it.