Get-PnPList not working correctly with subsite's subsite
adarshawasthi opened this issue · 2 comments
I am using below code to get lists of all subsites. But it is failing after one level of sitecollections. i cant connect with each web using Connect-PnPOnline as it takes too much time. Please suggest how to get lists of all subsites.
$webs= Get-PnPSubWebs -Recurse
foreach ($web in $webs)
{
write-host $web.Url -ForegroundColor Cyan
$sublists = Get-PnPList -web $web
}
i tried with below code as well but it is giving File Not Found error
$webs= Get-PnPSubWebs -Recurse
foreach ($web in $webs)
{
$SubWebs = Get-PnPSubWebs -Identity $web.Title -Recurse
foreach ($Subweb in $SubWebs)
{
write-host $Subweb.Url -ForegroundColor Cyan
$sublists = Get-PnPList -web $Subweb
}
write-host $web.Url -ForegroundColor Cyan
$sublists = Get-PnPList -web $web
}
Does this work?
$SubWebs = Get-PnPSubWebs -Identity $web.Url -Recurse