Advertisement
How to get a list of site collection with template for a web
application
The following
PowerShell script can be used to get a
list of site collections with template for a web application.
Get-SPSite -WebApplication http://c4968397007/-Limit All |
Select
-ExpandProperty AllWebs |
ft url, Title,WebTemplate, Created -auto |
out-string -width 1024 > c:\sites\sitetemplate.txt
How to get a list of site collections without template names for a web application
This script will get
only list of site collections without template names for a web application.
function GenerateAllSitecollections ($url)
{
try
{
$Site=Get-SPSite $url
$spWebApp =
$Site.WebApplication
$TotalList =
@()
write-host
"Below is the list of all site collections for a web application" +
$spWebApp + "….." -foregroundcolor red
foreach($allsites in $spWebApp.Sites)
{
$list
= $allsites.url
$listtemplatename = $allsites.WebTemplate
write-host
$list –foregroundcolor blue
write-host $listtemplatename
-foregroundcolor blue
}
}
catch
{
write-host
"Unable to Extract Site collection List in web application" -foregroundcolor
red
break
}
}
GenerateAllSitecollections
-Url " http://c4968397007/" > c:\sites\sitecollections.txt
0 comments:
Post a Comment