I realize the title of this entry is ambiguous. Specifically, you might be wondering if I mean site or site collection. The answer is: Yes. To make it less ambiguous, I will be referring to how things are in code, not the UI. The difference is that in code SPSite is actually a Site Collection (in the UI) and in code SPWeb is actually a Site (in the UI). The hierarchy of objects goes: SPWebApplication | SPSite | SPWeb where SPWebApplication and SPSite have Collection of the other objects below them. Below are example of how to get both SPSites and SPWebs.
Get number of SPWebs in your web application
$allwebs = Get-SPWebApplication http://www.sharepoint.com | Get-SPSite -Limit All | Get-SPWeb -Limit All
$allwebs.Count
Get urls of all the SPWebs in your web application
Get-SPWebApplication http://www.sharepoint.com | Get-SPSite -Limit All | Get-SPWeb -Limit All | select Url
Get number of SPSites in your web application
$allwebs = Get-SPWebApplication http://www.sharepoint.com | Get-SPSite -Limit All | Get-SPWeb -Limit All
$allwebs.Count
Get urls of all the SPSites in your web application
Get-SPWebApplication http://www.sharepoint.com | Get-SPSite -Limit All | Get-SPWeb -Limit All | select Url
No comments:
Post a Comment