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.

Tuesday, March 11, 2014

Download all SharePoint 2014 Conference Videos Powershell Script.

If you missed SPC2014 you can still download all of the session videos using this PowerShell script I lightly modified (just changed the path) from Vlad Catrinescu's script for SPC2012 that he adapted from Todd Klindt's script for Tech-Ed 2012.  :)  Both of which can be accessed here.

Now, here is the code (just copy, paste, and save as a .ps1):

[Environment]::CurrentDirectory=(Get-Location -PSProvider FileSystem).ProviderPath
$rss = (new-object net.webclient)

# Grab the RSS feed for the MP4 downloads

# SharePoint Conference 2012 Videos
$a = ([xml]$rss.downloadstring(""))

# Walk through each item in the feed
$ | foreach{  
    $code = $_.comments.split("/") | select -last 1      
    # Grab the URL for the MP4 file
    $url = New-Object System.Uri($_.enclosure.url) 
    # Create the local file name for the MP4 download
    $file = $code + "-" + $_.creator + "-" + $_.title.Replace(":", "-").Replace("?", "").Replace("/", "-").Replace("<", "") + ".mp4" 
    # Make sure the MP4 file doesn't already exist
    if (!(test-path $file))    
        # Echo out the  file that's being downloaded
        $wc = (New-Object System.Net.WebClient) 

        # Download the MP4 file
        $wc.DownloadFile($url, $file)