PowerShell – Create multiple SPWebs

I often find myself in need of building a structure of SPWebs for demo purposes or for custom migrating scenarios. In order for me to build the structure fast, test it and then tear it down or extend it, I use PowerShell.

Just extend the $url and the $name so they match your desire.

Add-PSSnapin microsoft.sharepoint.powershell
 $pre = "https://intranet/"
 $url = (

$name = (
 "Subsite name",

for($i=0; $i -le $url.Count; $i++)
 $urlvalue = $url[$i]
 $namevalue = $name[$i]
 New-SPWeb -Url($pre + $urlvalue) -Template CMSPUBLISHING#0 -UseParentTopNav -Name $namevalue -Language 1030

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.