How to create a massive amount of SharePoint sites in PowerShell

I recently wanted to create a large number of sites on my SharePoint installation and ended up writing a PowerShell script for the job that I thought I’d share. This was for a test for optimization, so I had to have quite a few in order to see some difference between tests.

First you have to find the template that’s going to be used on the sites. This is if you know the template you want to use:

But the template can also be fetched from a current site:

Then create a user that should be the owner of the site:

And then, cause I’m me and hate sites that are named test1, test2, test3 and so on, I made a list of site names:

And then you have to loop through all the names and create sites:

If you are lazy, here’s the script in its entirety.

Kommentera

E-postadressen publiceras inte. Obligatoriska fält är märkta *