Wednesday, August 31, 2011

PowerShell script to list all Webs and Site Templates

Today I wanted to know site templates of all webs with in a site collection. Easiest way to get this is via PowerShell.
Here is the PowerShell script to get all Webs within a SiteCollection and it prints Site Template name along with Title and URL. 
Just update $siteUrl and you are good to go.

$siteUrl = "http://myserver.com/"
$site = Get-SPSite $siteUrl
foreach ($web in $site.AllWebs) { 
            $web | Select-Object -Property Title, Url, WebTemplate 
}
$site.Dispose()

No comments:

Post a Comment