Find a SharePoint feature with PowerShell

As I keep having to figure this out every time I come to do it I’m leaving it here for reference.

To find a SharePoint feature when you only know part of the name of it the following command can be used:

 

Clone a web application

I needed to set up a new web application that was a copy of an existing web application. The constraint was that there was only one farm available to work with (I did have other farms but they were running different versions of SQL server).

Approach 1
I’ll first point out that this didn’t work, skip ahead if you’re not interested.
I went through the following steps:

  1. perform a SQL backup of the content database
  2. restore the backup into a new database
  3. created a new web application
  4. marked the content database that this created as offline
  5. attached the cloned database to the web application with the powershell command Mount-SPContentDatabase – I was sure to pass in the -AssignNewDatabaseId parameter

The result was the database attached but it had no site collections in it.

It turns out that this approach could work but only if you attach it to a different farm. You can then backup that database and restore/attach it back on the source farm.

As I stated at the beginning – I didn’t have the luxury of a second farm.

Approach 2
The only option left that I could think of was to backup and restore each site collection manually.
I knocked up the following powershell script to automate this and it worked …

 

Update SharePoint locale of all sites using Powershell

So I needed to ensure that all sites in my farm were formatting dates in the British format …
Powershell, once again, to the rescue! This is what I ended up with …

 

Output SharePoint group memberships with PowerShell

So I had a need to get a csv that could tell me who was in which groups in which sites.
Powershell to the rescue! This is what I ended up with …
There may be a better way to do this but the main thing is that it works and it was quick!