The mysterious case of Get-SPOSite


Sometimes you run into weird issues when you are doing the most common things. In this case, my colleague Marc Molenaar was cleaning up our demo Office 365 tenant.
To make an overview of all site collections, he ran the following cmdlet:

Get-SPOSite -Limit All | Export-CSV "C:\temp\sites.csv" 

This would make a list of all site collections that are available in our Office 365 tenant and export it to a CSV file.
When going through it, he noticed that none of the site collections were flagged as a hubsite. This couldn’t possibly be true as we created many hub sites for testing purposes.

I decided to check this in my own tenant to see if it was a local problem. So let’s see what happens.

The problem

Running the following PowerShell returns all site collections that contain the word intranet.

Get-SPOSite -Limit All | ?{$_.URL -like "*intranet*"} | select URL, IsHubSite



So it looks like we do not have any hub sites.
However, when I check the exact same thing for 1 of the site collections (which I know for sure is a Hub Site) by running:

Get-SPOSite | Select URL, IsHubSite



The current workaround is to get all site collections, and then use a foreach loop to go through them again and get the property.
In my case, I would run:

Get-SPOSite | Select URL, IsHubSite


You can also use the Get-SPOHubSite cmdlet to get all Hub Sites in your tenant.
Here is the result:



Hopefully this helps you find your Hub Sites succesfully!

Leave a Reply

Your email address will not be published. Required fields are marked *