Frage

I have a site collection "IM". In this site collection I have many subsites and in every subsite I have other subsites.

How can I get all subsites of the site collection using Powrshell?

I started to get first level of subsites but not the second one:

$snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
if ($snapin -eq $null) { Add-PSSnapin Microsoft.SharePoint.Powershell }
$IM = Get-SPWeb "http://manco-intranet/sites/investmentmanager/" 

foreach($Site in $IM)
{
    foreach($SubIM in $Site.Webs)
    {
        Write-Host $SubIM.title 
    }
}
War es hilfreich?

Lösung

Try with this

Add-pssnapin "Microsoft.Sharepoint.Powershell" 

Get-SPSite "http://SiteCollectionURL" | Get-SPWeb -Limit All | Select Title, URL | 
Export-CSV C:\SharePoint_Sites_Report.csv -NoTypeInformation

Change SiteCollectionURL and path to csv (C:\SharePoint_Sites_Report.csv)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit sharepoint.stackexchange
scroll top