I have a script the pull only one site collection list and library versioning details. How do I add a loop that will call for all sites and subsites list and libraries versioning details?
$cred = Get-Credential
Connect-PnPOnline -url https://test.sharepoint.com/sites/test1 -credentials $cred
$lists = Get-PnPList
$VersioningDetails = @()
foreach($list in $lists) {
$VersioningDetails += New-Object PSObject -Property @{
'List' = $list.Title
'Require Content Approval' = $list.EnableModeration
'Versioning Enabled' = $list.EnableVersioning
'Major Version limit' = $list.MajorVersionLimit
'Draft Version limit' = $list.MajorWithMinorVersionsLimit
'Drafts visible to' = $list.DraftVersionVisibility
'Checkout required' = $list.ForceCheckout
}
}
$VersioningDetails | Select 'List', 'Require Content Approval', 'Versioning Enabled',`
'Major Version limit', 'Draft Version limit', 'Drafts visible to', 'Checkout required'`
| Export-Csv versioningdetails.csv