When performing an upgrade or migration of an on premise SharePoint environment, it is important so check everything in the Farm. This particularly includes contentdatabases and sites. I ran into this when debugging a site that was partly deleted. I couldn’t get it removed and then tried to determine what the problem was, the SPSiteHealth check didn’t help me in this case. Eventually I force removed the site and after some timerjob had ran the site was gone.
Some examples to check sites for issues related to upgrades and migrations:
1 2 3 |
(Get-SPSite https://YourSiteUrl).RunHealthCheck('00000000-0000-0000-0000-000000000000',$false) Test-SPSite https://YourSiteUrl |
You can also have SharePoint repair the specific site for you:
1 2 3 |
(Get-SPSite https://YourSiteUrl).RunHealthCheck('00000000-0000-0000-0000-000000000000',$true) Repair-SPSite https://YourSiteUrl |
DESCRIPTION
The Repair-SPSite cmdlet runs one or all site collection health checks on the site collection and its contents. This cmdlet automatically repairs issues that it finds.
Run the Test-SPSite cmdlet for reports of rules which were run and a summary of the results.
Note: the only repairable SiteHealthRule is the “Missing Galleries” rule.
More info:
You run the health checks manually to prepare for an upgrade. In addition, the health checks are run automatically in repair mode when you start to upgrade a site collection. You can also run the health checks at any time to verify that a site is working as expected. The site collection pre-upgrade health checks examine a site collection and list potential upgrade issues, such as missing or unsupported elements. For example, the results itemize customized files so that you can identify the custom file and reset it to the default template in the site definition, if you want. After you run the checks, a report lists potential issues. The report also has information about how to address the issues.
About the site delete action, read this article from Bill Baer, it explains the internals concerning the site deletion in SharePoint 2010 and up worth. Next up, read this article which provides some Powershell commands to really delete your site. (Or just use it: Get-SPWebApplication | Get-SPDeletedSite | Remove-SPDeletedSite .)
It involves an SPTimerJob “Gradual Site Delete” (Microsoft.SharePoint.Administration.SPSiteDeletionJobDefinition) which is scheduled daily at night.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
PS C:\> $site.Delete OverloadDefinitions ------------------- void Delete() void Delete(bool bDeleteADAccounts) void Delete(bool deleteADAccounts, bool gradualDelete) PS C:\> $site.ContentDatabase.ForceDeleteSite OverloadDefinitions ------------------- void ForceDeleteSite(guid siteId, bool gradualDelete, bool restorable) PS C:\> Remove-SPSite -GradualDelete PS C:\> PS C:\> $site.RunHealthCheck('00000000-0000-0000-0000-000000000000',$false) Exception calling "RunHealthCheck" with "2" argument(s): "There is no Web named "/sites/xyz"." At line:1 char:1 + $site.RunHealthCheck('00000000-0000-0000-0000-000000000000',$false) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SPException PS C:\> PS C:\> Get-SPWebApplication | Get-SPDeletedSite WebApplicationId : 1c6b3aae-3319-4e9b-8dfc-6d3a9727a68f DatabaseId : 758c8d80-491a-4dc9-b01f-48dc3dc9aa9c SiteSubscriptionId : 00000000-0000-0000-0000-000000000000 SiteId : 8363b186-cf59-4730-ab92-444434e6af9a Path : /sites/xyz Scheme : Http Url : https://YourSiteUrl/sites/xyz DeletionTime : 27-3-2017 21:16:28 PS C:\> Get-SPWebApplication | Get-SPDeletedSite | Remove-SPDeletedSite -Confirm:$False PS C:\> Get-SPTimerJob | ?{$_.Title -match "gradual"} | Start-SPTimerJob PS C:\> $site.RunHealthCheck OverloadDefinitions ------------------- Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthSummary RunHealthCheck(guid ruleId, bool bRepair) PS C:\> (Get-SPSite "https://YourSiteUrl/sites/xyz").RunHealthCheck('00000000-0000-0000-0000-000000000000',$false) Site : SPSite Url=https://YourSiteUrl/sites/xyz Results : { SPSiteHealthResult Status=Passed RuleName="Conflicting Content Types" RuleId=befe203b-a8c0-48c2-b5f0-27c10f9e1622, SPSiteHealthResult Status=Passed RuleName="Customized Files" RuleId=cd839b0d-9707-4950-8fac-f306cb920f6c, SPSiteHealthResult Status=Passed RuleName="Missing Galleries" RuleId=ee967197-ccbe-4c00-88e4-e6fab81145e1, SPSiteHealthResult Status=Passed RuleName="Missing Parent Content Types" RuleId=a9a6769f-7289-4b9f-ae7f-5db4b997d284...} PassedCount : 7 FailedWarningCount : 0 FailedErrorCount : 0 PS C:\> $healthres = (Get-SPSite "https://YourSiteUrl/sites/xyz").RunHealthCheck('00000000-0000-0000-0000-000000000000',$false) PS C:\> $healthres.Results Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthConflictingContentTypeRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : No issues were found with conflicting content types. MessageAsText : No issues were found with conflicting content types. RuleName : Conflicting Content Types RuleId : befe203b-a8c0-48c2-b5f0-27c10f9e1622 RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRContentTypeConflict') RuleIsRepairable : False Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthCustomizedFilesRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : None of your existing files were detected as customized. MessageAsText : None of your existing files were detected as customized. RuleName : Customized Files RuleId : cd839b0d-9707-4950-8fac-f306cb920f6c RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRCustomizedFiles') RuleIsRepairable : False Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthMissingGalleriesRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : No issues were found with any of your galleries. MessageAsText : No issues were found with any of your galleries. RuleName : Missing Galleries RuleId : ee967197-ccbe-4c00-88e4-e6fab81145e1 RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRMissingGalleries') RuleIsRepairable : True Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthMissingParentContentTypeRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : No issues were found with missing parent content types. MessageAsText : No issues were found with missing parent content types. RuleName : Missing Parent Content Types RuleId : a9a6769f-7289-4b9f-ae7f-5db4b997d284 RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRMissingParentContentType') RuleIsRepairable : False Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthMissingTemplatesRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : No issues were found with any of your sites. MessageAsText : No issues were found with any of your sites. RuleName : Missing Site Templates RuleId : 5258ccf5-e7d6-4df7-b8ae-12fcc0513ebd RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRMissingTemplate') RuleIsRepairable : False Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthUnsupportedLanguagePackReferencesRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : No issues were found with any of your existing language pack references. MessageAsText : No issues were found with any of your existing language pack references. RuleName : Unsupported Language Pack References RuleId : 99c946f7-5751-417c-89d3-b9c8bb2d1f66 RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRUnsupportedLPK') RuleIsRepairable : False Rule : Microsoft.SharePoint.Administration.SiteHealth.SPSiteHealthUnsupportedMUIReferencesRule TimeStamp : 2/2/2017 1:02:22 PM Status : Passed Message : MessageAsHTML : No issues were found with any of your existing MUI language references. MessageAsText : No issues were found with any of your existing MUI language references. RuleName : Unsupported MUI References RuleId : 6da06aab-c539-4e0d-b111-b1da4408859a RuleHelpLink : javascript:HelpWindowKey('WSSEndUser_SHCRUnsupportedMUI') RuleIsRepairable : False PS C:\> |