This script allows you to get a list of all sites in a site collection in SharePoint Online / Office 365 using the Client Script Object Model.  This script requires references to the SharePoint Server 2013 Client Components SDK.  It can also be executed from a local SharePoint server.  Adjust the paths on the Add-Type statement as necessary.

Specify values in the following variables.


Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll"  
Add-Type -Path "c:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll"  
$siteUrl = “” 
$username = "" 
$password = Read-Host -Prompt "Enter password" -AsSecureString  
$ctx = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)  
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username$password)  
$ctx.Credentials = $credentials 
$rootWeb = $ctx.Web  
$sites  = $rootWeb.Webs 
foreach($site in $sites) 
    Write-Host $site.Title "-" $site.Url