Forum Discussion

Hirofumi OTA's avatar
Mar 29, 2018
Solved

Removed Hub Site still display as Hub Site

I did create Hub Site by SharePoint Online Management Shell. after, I did remove that Hub Site permanentaly by SharePoint Online Management Shell (using Remove-SPOSite and Remove-SPODeletedSite).

 

However, Removed Site is still display as Hub Site on "Hub site association" dropdown list and Get-SPOHubSite.

 

How can I remove that Hub Site?

 

I tried the following.

 

1. Unregister-SPOHubSite
Return; Unregister-SPOHubSite : File Not Found

 

2. Tenant.UnregisterHubSite method
https://msdn.microsoft.com/en-us/library/microsoft.online.sharepoint.tenantadministration.tenant.unregisterhubsite.aspx
Return; Exception calling "ExecuteQuery" with "0" argument(s): "File Not Found"

 

Does anyone have a good idea to solve?

  • Just in case anyone runs into this.......

     

    1. Download and Install latest version of SharePoint OnlineManagement shell for Powershell
      https://www.microsoft.com/en-US/download/details.aspx?id=35588
    2. Connect to Sharepoint Online admin site via powershell
      Connect-SPOService -Url "https://<tenant>-admin.sharepoint.com"
    3. View hubsite information
      Get-SPOHubsite
    4. Copy the ID of the hubsite you wish to delete
    5. Run the unregister command and add the ID
      Unregister-SPOHubSite 4f4cfc32-5331-4af8-8e96-eb820653d8dc
      (note that I did NOT add "-Identity" when using only the ID of the hubsite

14 Replies

    • pnthrzrule's avatar
      pnthrzrule
      Iron Contributor

      Beau Cameron 

      Whoa! This worked like a charm! Thanks for this tip! At first I was a little concerned about locating the GUID since I had already deleted the Hub site in the admin center. However, running Get-SPOHubsite in the SPOnline mgmt shell actually showed met he GUID for the deleted sites (which I think is kinda weird). Either way I was able to grab the id and they were gone in a flash. I had been living with these annoyances for over a year!

  • kAuShAL gAjjAr's avatar
    kAuShAL gAjjAr
    Copper Contributor

    Hi Hirofumi

     

    The reason this happens is because you might have deleted the site without removing the association first. If the site is deleted the association gets orphaned and so far Microsoft has no SDK to remove orphaned sites. Although they are working on it and I see updates almost every week it would be good to keep an eye for the update on this.

     

    This is what  I do for super clean SPOSite deletions :

     

    $Iterations = "","1"
    foreach($Iteration in $Iterations) {
              Write-Host "Iteration : " $Iteration

              Remove-SPOHubSiteAssociation "https://<<tenant>>.sharepoint.com/sites/<<site>>$Iteration"

              Unregister-SPOHubSite -Identity "https://<<tenant>>.sharepoint.com/sites/<<site>>$Iteration" -Force
              Remove-SPOSite -Identity "https://<<tenant>>.sharepoint.com/sites/<<site>>$Iteration" -Confirm:$false
              Remove-SPODeletedSite -Identity "https://<<tenant>>.sharepoint.com/sites/<<site>>$Iteration" -Confirm:$false
    }

     

    Hope this helps.

     

    Cheers

    Kaushal

    • Fernando Melo's avatar
      Fernando Melo
      Brass Contributor

      has anyone been able to fix this problem? i am still running into it.

      The hubsite has been deleted:
      Remove-SPOHubSiteAssociation : File Not Found.
      At line:1 char:1
      + Remove-SPOHubSiteAssociation https://ahcusadev.sharepoint.com/sites/W ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo : NotSpecified: (:) [Remove-SPOHubSiteAssociation], ServerException
      + FullyQualifiedErrorId : Microsoft.SharePoint.Client.ServerException,Microsoft.Online.SharePoint.PowerShell.RemoveSPOHubSiteAssociation

       

      Using the IDentity tag i get  

      Unregister-SPOHubSite : Cannot bind parameter 'Identity'. Cannot convert value "ecbbd04f-3a0a-406b-b8c4-2553ab16b2b5" to type
      "Microsoft.Online.SharePoint.PowerShell.SpoHubSitePipeBind". Error: "SpoHubSitePipeBind Url"

  • I can delete Hub Site by using latest SPO Management Shell: Unregister-SPOHubSite <SiteId>

    • Michal Golan's avatar
      Michal Golan
      Copper Contributor

      Hi,
      I'm facing the same problem and I dont know the site ID or the URL since I've deleted it 
      any other ideas??

      • Hirofumi OTA's avatar
        Hirofumi OTA
        MVP

        Can you get SiteId by Get-SPOHubSite?? Get-SPOHubSite cmdlet return SiteId that include deleted it.

    • Fernando Melo's avatar
      Fernando Melo
      Brass Contributor

      I too am having this problem.

      IS there anyway to solve this?

       

Resources