0

Does anyone know how I can Iterate through a series of Site Collections in a Office 365 tenancy using PnP PowerShell ? I can get a series of Site Collections using :-

$sitecollections = Get-PnPTenantSite

I now want to iterate through the site collections printing out the title and Url using PnP PowerShell

1 Answer 1

2

From the admin site, the available site collections can be retrieved, using PnP CSOM PowerShell and run the following:

$sites = Get-SPOTenantSite -Detailed -IncludeOneDriveSites -Force

Write-Host "There are " $sites.count " site collections present"

foreach($site in $sites){

    Write-Host "Title       : " $site.Title

    Write-Host "URL         : " $site.Url

    Write-Host "Template    : " $site.Template

    Write-Host "Status      : " $site.Status

    Write-Host "Storage (MB): " $site.StorageMaximumLevel

    Write-Host "Used (MB)   : " $site.StorageUsage

    Write-Host "Resources   : " $site.UserCodeMaximumLevel

    Write-Host "Owner       : " $site.Owner

    Write-Host "Sharing     : " $site.SharingCapability

    Write-Host "subsites    : " $site.WebsCount

    Write-Host "-----------------------------------------"

}

Here is the link: https://globaltechstop.wordpress.com/2016/07/12/working-with-sharepoint-site-collections-on-office365-tenant-site-using-pnp-powershell/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.