UPDATE 11/9/13: Added SourceCode Formatting
PROBLEM:
I was running QueryFeatures on the SPWebApplication to find a SPFeature object to upgrade, but was receiving an error about a deleted site.
An error occurred while enumerating through a collection: The site with the id 8e79d05f-3f0c-4627-8311-7d29b2a2c4a3 could not be found..
At line:1 char:1
+ <<<< (Get-SPWebApplication http://www.devsite.com/).QueryFeatures(‘afda6a62-4389-402f-af19-11bd9ee2b99a’) | ?{$_.Parent.Url -like "http://www.devsite.com/specific/site"} + CategoryInfo : InvalidOperation: (Microsoft.Share…esultCollection:SPFeatureQueryResultCollection) [], RuntimeException + FullyQualifiedErrorId : BadEnumeration
Simon Doy does a good job of explaining the issue in more detail. I had previously created and deleted a site collection for testing purposes and that is when my problems started.
SOLUTION:
To solve the issue I started by running the Get-SPDeletedSite command to find the problem sites. I then removed the deleted sites with Remove-SPDeletedSite. Next, I ran a refresh on the content database to make sure the list of sites was update in the configuration database. The whole PowerShell process looked a little something like this:
PS C:\Users\beavel> Get-SPDeletedSite WebApplicationId : 00000000-0000-0000-0000-000000000023 DatabaseId : 00000000-0000-0000-0000-000000000024 SiteSubscriptionId : 00000000-0000-0000-0000-000000000000 SiteId : 8e79d05f-3f0c-4627-8311-7d29b2a2c4a3 Path : /team/site1 DeletionTime : 6/25/2012 8:32:31 PM WebApplicationId : 00000000-0000-0000-0000-000000000023 DatabaseId : 00000000-0000-0000-0000-000000000024 SiteSubscriptionId : 00000000-0000-0000-0000-000000000000 SiteId : 5fcf2a3b-ee9e-4d27-8e7b-4c7185396dce Path : /team/site2 DeletionTime : 6/25/2012 8:18:48 PM PS C:\Users\beavel> Remove-SPDeletedSite -Identity 5fcf2a3b-ee9e-4d27-8e7b-4c7185396dce Confirm Are you sure you want to perform this action? Performing operation "Remove-SPDeletedSite" on Target "/team/site2". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):y PS C:\Users\beavel> Get-SPDeletedSite WebApplicationId : 00000000-0000-0000-0000-000000000023 DatabaseId : 00000000-0000-0000-0000-000000000024 SiteSubscriptionId : 00000000-0000-0000-0000-000000000000 SiteId : 8e79d05f-3f0c-4627-8311-7d29b2a2c4a3 Path : /team/site1 DeletionTime : 6/25/2012 8:32:31 PM</pre> <pre>PS C:Usersbeavel> Remove-SPDeletedSite -Identity 8e79d05f-3f0c-4627-8311-7d29b2a2c4a3 Confirm Are you sure you want to perform this action? Performing operation "Remove-SPDeletedSite" on Target "/team/site2". [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"): PS C:\Users\beavel> $db = Get-SPContentDatabase -Identity 5a83c168-d8e8-44c7-b5d3-46b8d87d9a06 PS C:\Users\beavel> $db.RefreshSitesInConfigurationDatabase()I was still running into issues with my original command. To get things working, the “Gradual Site Delete” time job needed to be run for the Web Application that contained the two sites. This was run from Central Admin instead of PowerShell. Once it had completed, I was again able to run my original command. I’m not sure the DB refresh was needed in this process. You may be able to get by without it as I have not tested.
Leave a Reply