Creating a SharePoint Site Structure with Powershell

Sometimes, when starting a new SharePoint branding project, it’s useful to have a large site structure, to see how navigation is rendered, and how styling affects different site templates. Creating many sites manually can take time, especially if the site structure is several layers deep. To speed this process up, I use Powershell to create the structure for me.


To do, this I use a CSV file, as this allows me to easily edit and add sites by using Excel. The CSV contains the properties of the SPWeb object. I then use the Import-CSV cmdlet to loop through the CSV file, and then use the New-SPWeb cmdlet to create each SPWeb.

The above snippet will loop through the CSV, creating sites using the Url column, and the Name column. Each site created will use the parent top nav, and the publishing template. Each column in the CSV file can be referenced with ‘$_.’, which means you can add as many different properties as you need.

For more Information on New-SPWeb, try typing Get-Help New-SPWeb