1

Assuming Connect-SPOService is connected successfully. Why am I getting error for Get-SPOWebs error. I am trying to get subsite of sposite but getting this error.

function get-siteCollections{

#Get all site collections

$siteCollections = Get-SPOSite

#loop through all site collections

foreach ($siteCollection in $siteCollections)

{

#set variable for a tab in the table

$pixelsweb = 0

$pixelslist = 0

#add info to HTML document

add-content -value "<tr style='background-color:cyan'><td>$($siteCollection.url)</td><td>TopSite</td><td>$($sitecollection.template)</td><td></td></tr>" -path $filePath

write-host "Info: Found $($siteCollection.url)" -foregroundcolor green

#search for webs

$AllWebs = Get-SPOWebs($siteCollection.url)
Write-Host $AllWebs

}

get-sitecollections
1

Get-SPOWebs is not the built-in function. You need to define it like this:

Powershell to list all sites and subsites in SharePoint Online

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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