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
This is a really helpful and practical topic, especially for anyone managing large SharePoint environments.. Using PowerShell to retrieve a list of site collections saves time, improves accuracy, and makes administration much more efficient compared to manual methods. Clear scripting like this also highlights how automation supports better decision making and system governance,. Interestingly, these kinds of technical process optimizations can even relate to project topics for international business management, where efficient IT infrastructure and scalable systems play a key role in supporting global operations and enterprise-level projects.
ReplyDelete