Monday, September 15, 2014

How to extend the expiration date of a SharePoint 2013 evaluation site.

I was recently asked to extend the life of a SharePoint 2013 Eval site collection.

After a little digging i found a nice powershell method that takes care of this. However, it wasn't crystal clear on how to set the property.

So to save others the time of trying to figure it out, I thought I'd just post the process here.

Lets get started...

First get the site:
$site = get-spsite <eval site url>

Next get the expiration date:

Now the trick...
There are a few ways to add time to the expiration date.  You can AddDays, AddHours, AddYears, etc...
I went with the AddDays method.  It takes a argument of a double to represent the number of days to add.  For this example I'm adding 14 days to the current expiration date.

The command looks like this:

So now you think your are done right?  Wrong!

What hung me up was you have to use the "set" method to actually apply this new date to the site.
So here we go:

Store my new date to an object.
$myNewDate = $site.expirationdate.adddays(14)

Now set my site expiration date to the new date (additional 14 days.)
$site.expirationdate = $myNewDate

Now you can view the new expiration date by re-instantiating the $site object.
$site = get-spsite <eval site url>


This should now reflect the new date that is 14 days longer.

Good luck and happy share-pointing.