Using SharePoint Search Query Tool I have found out that some old "ghost" instances of my site collections exist on some servers in a big farm. When I use the search functionality in SharePoint I get search results from both these old site collections and the proper site collections. The GUIDs (SiteId) of the old site collections and the proper site collections differ, but the GUIDs (WebId) of the sites in both collections are identical.

This is SharePoint 2016 on-premise and I do not have access to the server. I have site collection admin permissions.

All I know about these "ghost" site collections are their site collection GUID:s. I wonder how I can find out more about these "ghosts", so that I can explain the issue to a server admin far away in another country? Maybe I am able to browse to the URLs and remove the old site collections myself if I know where they are? But I am afraid there may be redirects involved also.

I have found a method in CSOM that seems to accept GUIDs (Site.OpenWebById), but I do not know what to specify as context, so I do not know how to write the code. Or are there other ways?

This problem is really making the search functionality and my web parts using search completely useless, because nobody can rely on the search results.

  • Do you have access to run the powershell commands? Feb 20, 2019 at 17:46

2 Answers 2


Hello you should tell your SharePoint Administrators to check SharePoint Search Service Application, Content Sources, Crawl Logs and Errors.

They probably need to Reset Index and Full Crawl the correct items, cause it looks like there is some problem with indexing of content if it displaying ghosted items...

I think using filtering in Search Web Query WP is not a solution!

Hope it helps!

  • Thanks for your feedback! My idea with CSOM was not to filter WP, it was to get some clues where the ghosts are. If the URL says something about a stage environment I can point the admin in that direction.
    – Gunilla
    Feb 20, 2019 at 15:59
  • But they should see errors in Crawl Logs, you dont need some info, they should be able to find it faster :) Feb 20, 2019 at 16:31
  • or they can run Test-SPcontentDatabase and it will show if there are orphans and where, or they can run "stsadm.exe -o localupgradestatus" Feb 20, 2019 at 16:34

Try using some powershell commands as given below(Not tested):

Solution 1:

Save All Site GUID on local drive. For example, E:\temp\SiteID.txt with each ID on new line and run below script:

$content = Get-Content E:\temp\SiteID.txt
foreach($line in $content)
    $site = Get-SpSite $line
    $site.Url + "," + $site.Id.Guid | out-file E:\temp\SiteUrl.txt -append -width 1000

Solution 2

So you should be able to get the url by using:

Get-SPWeb -Site 5953f454-5681-45b8-b2b0-c28a74608e11 | WHERE  {$_.Id -eq "d30d787b-9c5c-4deb-8e05-0a597f1bdf38"} | Select Url, Title

Where the first GUID is the Site GUID (id) and the second one the Web guid (id).

  • I can run PowerShell, but only on my client machine, not on the server. Since I am not on the server, it seems I cannot run Add-PSSnapin Microsoft.Sharepoint.Powershell to get access to run any SharePoint cmdlets. Also, it seems there exists no corresponding Microsoft.Sharepoint.[Client].Powershell.dll that I can get installed to the GAC of my client machine. And I have no idea what to specify as client context, which is required by the client-side APIs.
    – Gunilla
    Feb 21, 2019 at 14:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.