PowerShell

Force renewal of Content Types

Arjan Cornelissen
This week we had an issue where we had some differences in the Content Types that where pushed from the Content Type hub. We wanted to make sure all Content Types where updated in the next push. After some digging around on the internet I found that there is a property in the SPWeb.Properties called “MetadataTimeStamp”. This property contains the date of the last sync with this site collection. If you clear the value of this property, the Content Type synchronization Job will update this sitecollection.

Upgrade Server 2012 to Server 2012 R2 with SharePoint 2013 SP1

Arjan Cornelissen
With the release of SharePoint 2013 SP1, Server 2012 R2 is now supported. With this release I wanted to try to upgrade my dev environment to Server 2012 R2. My dev machine has all roles, so AD, SQL and SharePoint. The steps below I used to upgrade the machine. Install SharePoint SP1 as you usually install an update Make sure you have enough free space, I needed 12GB. Mount the ISO of Server 2012 R2 and run the following command ‘adprep /domainprep’, the adprep command can be found on the disc in the folder ‘\sources\adprep’

SPC14 Sessions

All the sessions of the SharePoint Conference 2014 are now available on Channel9. Like many other people I like to watch some of the sessions I missed during the conference. I also do not like to watch this from my laptop so I wanted to download the sessions I would like to see. After a few hours of trying myself I found on Yammer that there were many others trying the same thing and 1 had created and shared a really nice PowerShell script to download everything.

Undeclare In-Place records

Arjan Cornelissen
Last week I had a question to remove a document library with items that where records. Then you have an option to remove the record status of every document by hand, this is ok for a few items but in this case there were a few thousand items and only some of them had the status Record. With some searching on the internet I found a code snippet to remove the record status of a document.

Unexpected logout with SharePoint 2013 and ADFS

Arjan Cornelissen
The last couple of weeks I was creating and configuring 3 SharePoint 2013 farm (Test, acceptance and Production) on Windows Azure. We did the provisioning, installation and configuration with PowerShell. This way we had the basics within 1 week running. Because we are on Windows Azure and the company did not want their AD extended to the Windows Azure environment we configured SharePoint with ADFS 3.0. This way we could give the end user a single sign on experience that they are used to and make it directly possible to let them connect from outside the company network.

PowerShell not enough memory

Arjan Cornelissen
Today I was running a PowerShell script to remove all records in a SharePoint List, but I got an exception that PowerShell did not have enough memory. By default PowerShell has a memory limit of 1GB You can check the amount of memory with the following command within a Admin PowerShell window get-item wsman:localhost\Shell\MaxMemoryPerShellMB To change this the following command can be ran set-item wsman:localhost\Shell\MaxMemoryPerShellMB 2048

Audit settings

Arjan Cornelissen
This week I was trying to make some PowerShell scripts to set the auditing in SharePoint. This can be done very easy with the GUI, but I had to set this on a few thousand sites. With the GUI you can go to the site collection and then settings. Under ‘site collection administration’ you find ‘Site collection audit settings’ Just select the options you want and you’re all set to use auditing.

PowerShell behind the Proxy

Arjan Cornelissen
Lately I was working on Windows Azure with PowerShell at a customer. As most of my customers have a proxy, I had some issues with the cmdLets to get to Azure. After searching the web I found a nice solution to use to get authenticated with the proxy for PowerShell. Start your PowerShell with the following command or use it in your scripts $proxy = [System.Net.CredentialCache]::DefaultCredentials [System.Net.WebRequest]::DefaultWebProxy.Credentials = $proxy