2

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
Gautam Sheth
  • 30,881
  • 1
  • 35
  • 62
allegro octopus
  • 2,146
  • 11
  • 44
  • 76

1 Answers1

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

AlexZh
  • 637
  • 4
  • 9