Archive

Archive for January, 2011

Fixing pages and their layouts after importing a published site

January 21, 2011 1 comment

If you export a publishing site from one farm and import it to another, you may be surprised that none of your pages will work.  I recently got the following error:

 

image

The problem is the page is hard-coded to the page layout from the original site.

The following Powershell script that my buddy Raj wrote will fix the problem:

 

Code Snippet
  1. function LoadSharePointPowerShellEnvironment
  2. {
  3.     write-host
  4.     write-host "Setting up PowerShell environment for SharePoint" -foregroundcolor Yellow
  5.     write-host
  6.     Add-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue
  7.     write-host "SharePoint PowerShell Snapin loaded." -foregroundcolor Green
  8. }
  9.  
  10. write-host
  11. LoadSharePointPowerShellEnvironment
  12.  
  13. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
  14. [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Publishing")
  15.  
  16. $web = Get-SPWeb -Identity "http://myserver/sites/sales/wiki"
  17.  
  18. $spPubWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
  19. $pages = $spPubWeb.PagesList
  20.  
  21. foreach($item in $pages.Items)
  22. {
  23.   $pubPage = [Microsoft.SharePoint.Publishing.PublishingPage]::GetPublishingPage($item)
  24.  
  25.   $url = new-object Microsoft.SharePoint.SPFieldUrlValue($pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout].ToString())
  26.   if($url -ne $null)
  27.   {   
  28.   $ss =$url.Url
  29.     if($ss -match'TreeWikiLayout')
  30.   {  
  31.   $newurl = new-object Microsoft.SharePoint.SPFieldUrlValue("http://myserver/sites/sales/_catalogs/masterpage/TreeWikiLayout.aspx, Enterprise Wiki Layout with Tree")
  32.   $pubPage.Name
  33.   $pubPage.CheckOut()
  34.   $pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout] = $newurl
  35.   $pubPage.ListItem.UpdateOverwriteVersion()
  36.  
  37.   $pubPage.ListItem.File.CheckIn("Fixed URL to page layout.", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn);
  38.   }
  39.     elseif($ss -match'EnterpriseWiki')
  40.   {
  41.   $newurl = new-object Microsoft.SharePoint.SPFieldUrlValue("http://myserver/sites/sales/_catalogs/masterpage/EnterpriseWiki.aspx, Basic Page")
  42.   $pubPage.Name
  43.   $pubPage.CheckOut()
  44.   $pubPage.ListItem[[Microsoft.SharePoint.Publishing.FieldId]::PageLayout] = $newurl
  45.   $pubPage.ListItem.UpdateOverwriteVersion()
  46.  
  47.   $pubPage.ListItem.File.CheckIn("Fixed URL to page layout.", [Microsoft.SharePoint.SPCheckinType]::MajorCheckIn);
  48.   
  49.   }
  50.   }
  51.  
  52. }

 

It’s a little odd that this issue was carried over from 2007 to 2010, but there you go….

Categories: SharePoint Tags:

SharePoint 2010 Setup unable to proceed due to a pending system restart

January 11, 2011 6 comments

A recent install resulted in the following error:

“Setup is unable to proceed due to the following error(s): A system restart from a previous installation is pending.”

image

The problem was related to a registry key “PendingFileRenameOperations” located at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager.

image

Fix

Rename the key to PendingFileRenameOperations1 and you will be able to proceed with the install.

Categories: SharePoint Tags:
Follow

Get every new post delivered to your Inbox.

Join 39 other followers