Last week I tried to do a version upgrade for a site collection and got a white blank screen after the upgrade.
Even the application pages in layouts folder (e.g. settings.aspx) display nothing.
That’s more a downgrade right? 😉
Cause
When you activate the SharePoint Server Publishing Infrastructure feature, SharePoint will add the variationrootpagelayout.aspx file to your masterpage catalogs.
This file causes troubles!
Solution
Deactivate the publishing feautre and delete the variation file.
File to delete: http://www.mysharepoint.com/sites/mysite/_catalogs/masterpage/VariationRootPageLayout.aspx
To delete the file you can use sharepoint designer or go to the gallery in site settings.
Hints: You must deavtivate the publishing web feature first, then the site feature.
And because I am nice, I’m sharing this awesome Powershell lines with you
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 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
#region Parameters param( [string]$URL, [string]$Path ) if(-not($URL)) { Throw "You must supply a value for -URL. Examples -URL http://mysharepoint.com" } if(-not($Path)) { Throw "You must supply a value for -URL. Examples -Path C:\Users\schorern\Desktop\" } #endregion #region Setup #adds a back slash if necessary if (!$Path.EndsWith('\')) { $Path = "$Path\" } $site = Get-SPSite -identity $URL $SiteTitle = $site.rootweb.title $Publishing = "Publishing.csv" $PostUpgrade = "PostUpgrade.ps1" $PrefixPath = "$Path$SiteTitle" New-Item -ItemType directory -Path $PrefixPath $PrefixPath = "$PrefixPath\" $ScriptFile = "$PrefixPath$PostUpgrade" $CSVPublishing = "$PrefixPath$Publishing" $web = get-spweb -identity $site.url $foldernameCOFs = "CheckedOutItems/" $folderCOFs = "$PrefixPath$foldernameCOFs" $CheckoutFileEnding = "CheckedoutItems.csv" $CheckOutFile = "$folderCOFs$CheckoutFileEnding" $foldernameAllFeats = "ActivatedFeatues/" $folderAllFeats = "$PrefixPath$foldernameAllFeats" #endregion function Clean { $site = Get-SPSite -identity $URL $web = get-spweb -identity $site.url $SiteTitle = $site.rootweb.title Write-Host LogPath: $CSVPublishing Add-Content -LiteralPath $CSVPublishing -Value "URL,Featurename" ### All SubSites Publishing Feature ### Foreach($subsite in $web.webs) { $feature = Get-SPFeature -web $subsite.url -identity Publishing -ErrorAction SilentlyContinue if ($feature -ne $null) { Disable-SPFeature -identity "Publishing" -URL $subsite.url -Confirm:$FALSE $subsiteurl = $subsite.url Write-Host "Deactivated Publishing Feature On " $subsiteurl Add-Content -LiteralPath $CSVPublishing -Value "$subsiteurl,Publishing" } } ### Rootweb Publishing Feature ### $feature = Get-SPFeature -web $web.url -identity Publishing -ErrorAction SilentlyContinue if ($feature -ne $null) { Disable-SPFeature -identity "Publishing" -URL $web.url -Confirm:$FALSE Write-Host "Deactivated Publishing Feature On " $web.url Add-Content -LiteralPath $CSVPublishing -Value "$URL,Publishing" } ###### Site Features ##### #PublishingSite $feature = Get-SPFeature -site $site.url -identity PublishingSite -ErrorAction SilentlyContinue if ($feature -ne $null) { Disable-SPFeature -identity "PublishingSite" -URL $site.url -Confirm:$FALSE -ErrorAction SilentlyContinue Write-Host "Deactivated PublishingSite Feature On " $site.url Add-Content -LiteralPath $CSVPublishing -Value "$URL,PublishingSite" } $masterpagelist = $web.Lists | Where-Object {$_.EntityTypeName -match "_masterpage"} $variationfile = $masterpagelist.Items | Where-Object {$_.name -match "VariationRootPageLayout.aspx"} if($variationfile -ne $null) { $variationfile.delete() Write-Host "Deleted: VariationRootPageLayout.aspx" } Write-Host "Done" } function CreatePostUpgradeScript { $var = '$Features' Add-Content -LiteralPath $ScriptFile -Value "$var = Import-CSV $CSVPublishing" Add-Content -LiteralPath $ScriptFile -Value 'foreach($Feature in $Features)' Add-Content -LiteralPath $ScriptFile -Value '{Enable-SPFeature -Identity $Feature.Featurename -Url $Feature.URL -Confirm:$False}' Write-Host $ScriptFile Write-Host $CSVPublishing Write-Host Done } function GetCheckedItems($spWeb) { Write-Host "Scanning Site: $($spWeb.Url)" foreach ($list in ($spWeb.Lists | ? {$_ -is [Microsoft.SharePoint.SPDocumentLibrary]})) { Write-Host "Scanning List: $($list.RootFolder.ServerRelativeUrl)" foreach ($item in $list.CheckedOutFiles) { if (!$item.Url.EndsWith(".aspx")) { continue } $WebUrl = $spWeb.url; $itemUrl = $spWeb.Site.MakeFullUrl("$($spWeb.ServerRelativeUrl.TrimEnd('/'))/$($item.Url)"); $checkoutBy = $item.File.CheckedOutBy.DisplayName; $checkedoutSince = $item.File.CheckedOutDate.ToString(); $userEmail = $item.File.CheckedOutByUser.Email; Add-Content -LiteralPath $CheckOutFile -Value "$WebUrl,$itemUrl,$checkoutBy,$checkedoutSince,$userEmail"; } foreach ($item in $list.Items) { if ($item.File.CheckOutStatus -ne "None") { if (($list.CheckedOutFiles | where {$_.ListItemId -eq $item.ID}) -ne $null) { continue } $WebUrl = $spWeb.url; $itemUrl = $spWeb.Site.MakeFullUrl("$($spWeb.ServerRelativeUrl.TrimEnd('/'))/$($item.Url)"); $checkoutBy = $item.File.CheckedOutBy.DisplayName; $checkedoutSince = $item.File.CheckedOutDate.ToString(); $userEmail = $item.File.CheckedOutByUser.Email; Add-Content -LiteralPath $CheckOutFile -Value "$WebUrl,$itemUrl,$checkoutBy,$checkedoutSince,$userEmail"; } } } } function AllCheckedOutItems { New-Item -ItemType directory -Path $folderCOFs Add-Content -LiteralPath $CheckOutFile -Value "Web url,Item url,Checkout by,Checked out,User Email"; GetCheckedItems($web) Foreach($subsite in $web.webs) { #webtitle = $subsite.title; #$CheckOutFile = "$folderCOFs$webtitle$CheckoutFileEnding" GetCheckedItems($subsite) } } Clean; CreatePostUpgradeScript; |
To use this script: .\PreMigrationCleaner.ps1 -URL “http://mysharepoint.com/sites/myteamsite” -Path “c:\users\kampan\desktop”
This script
– logs all the activated features
– logs all checked out items/files
– delete variationrootpagelayout.aspx file
– deactivate all publishing features and logs the url and feature name in a csv file
– creates a post upgrade script which allows you to reactivate the publishing features according to the autogenerated csv file (you must run the scripts twice: 1st to activate the site feature 2nd to activate the web features)
Download
Cheers!