Get The SharePoint Online Sub-Sites Using PowerShell

Here, we will learn how to populate the SharePoint sub-site information, including Title, URL, Template, etc., in SharePoint Online. By default, SharePoint Online Management Shell doesn’t have the cmdlets called Get-SPOWeb.
 
So, we need to find a SPOWeb module to import to the PowerShell. After a long search on Google, I have found the SPOWeb module at TechNet.
 
As described on the site, first, we need to import the module to our PowerShell console. Just download it somewhere in your computer and open the PowerShell ISE and type the following command.
  1. Import-Module C:\GETSPOWebModule.psm1 –Verbose  
Get the SharePoint Online Sub-sites using PowerShell
 
Now, you can resolve the Get-SPOWeb cmdlets in your PowerShell console. Then, let us test it. For that, just type Get-SPOWeb and press F5. It will ask for username and password to log into the SharePoint Online. 
 
Get the SharePoint Online Sub-sites using PowerShell
 
Ok, it is returning some result. We will bring that informal structure using FL command.
  1. Get-SPOWeb –URL https://osspdy.sharepoint.com –Username [email protected] –adminPassword XXXXXXXXXX | Select Title, URL, WebTemplate  
And now, we will get the count of sub-sites under one site collection using the same cmdlets.
  1. $subsite = Get-SPOWeb -Url https://osspdy.sharepoint.com -Username [email protected] -AdminPassword XXXXXXXXX  
  2. $subsite.sites.count  
It will display the count of sub-sites available under the mentioned site collection.