I have a development environment, a test environment and a production environment. I develop packages in the development environment and update the solution in the test environment. As it turns out my PageLayout didn't change according to the development environment. I asked a colleague what could be wrong and we started investigating.

As it turns out, the PageLayout didn't change, and hasn't changed for over a year. But the field TaskDueDate failed since it was written in Swedish. Since this is a test environment I changed the field in SharePoint designer to the correct name, and the pages refering the PageLayout started to work as expected.

So my colleage and I decided to Re-Ghost the PageLayout to its Ghosted state to be able to deploy it from our development environment created package. I found a useful beginning of a script and run it just to test what I got.

$site = Get-SPSite https://intranet.company.se
$web = $site.RootWeb

$pubSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($site)
$pageLayouts = $pubSite.PageLayouts

foreach ($pageLayout in $pageLayouts)
    $file = $web.GetFile($pageLayout.ServerRelativeUrl)

    if ($file.CustomizedPageStatus -eq "Customized")
        Write-Host "Layout page name: " $file.Name        
        Write-Host "   Status before: " $file.CustomizedPageStatus


        Write-Host "    Status after: " $file.CustomizedPageStatus


As it turns out there where four of 20 PageLayouts that was UnGhosted according to the above script. This is unexpected and I find myself caught in the middle. Should I save the current UnGhosted PageLayouts as a backup and Re-Ghost them and see what happens - or should I leave them in UnGhosted (un-deployable) mode?


If it's solely on the test environment and not on the production environment (hence the "test"), you can safely revert the filestream so that the content is retrieved from the file system.

Since there are only 4 page layouts unghosted, you can grab them from the master page gallery ("download a copy") on that environment and apply a comparison with the one you have on your packages, in order to synchronise them and apply the relevant modifications (if any) in your dev environment / package. (BeyondCompare is a really nice tool for that but there are a lot of them).

What about the production environment ? Does it have unghosted / customized page layout ? Would you be able to do the same operation (launch that PowerShell script) if it was the case ?

Finally a good old stsadm -o backup as a safe net is always welcome, just in case anything bad happens (unable to revert filestream, missing content added manually, broken page layout,etc).

  • +1! The test environment is a full restore from production backups made later than the dates present on the four PageLayouts, so I would imagine they are unghosted too. At least my field have the same fault as the test environment - but I havn't run the script there (yet). I'll try the BeyondCompare tool tomorrow and see what we get, thank you. – Benny Skogberg Jan 29 '13 at 20:45
  • 1
    Any file comparison tool will do the job (even the Notepad++ plugin but that BC tool is one of my favorite and they have a trial) Let us know how everything turned out ! – Francois Verbeeck Jan 29 '13 at 20:46
  • I run the script - uncommented and it went well. However one PageLayout refuses to go Ghosting again. I wonder why? Everything else worked like a charm – Benny Skogberg Jan 30 '13 at 12:19
  • Its definition is still at the expected location (14\Templates\Features\XYZ\your-page-layout.aspx ? – Francois Verbeeck Jan 30 '13 at 12:22
  • It's there with todays date after re-installing the wsp-package. – Benny Skogberg Jan 30 '13 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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