Skip to content
September 18, 2012 / red1s

PowerShell Script for auto updating MOSS 2007 databases to SharePoint 2010


Recently we went through a repetitive upgrade process for multiple site collections.

The problem with having multiple site collections is that there are multiple databases to upgrade.

Within my project there were over 20+ databases.

clip_image001

I therefore decided to build/modify the following PowerShell script to assist me in doing the job:

Based on the switches you can add further functional items to the script, alternatively you can loop the function to iterate through another file (possibly csv) to iterate through all your databases

function main()

{

Clear-Host;

Write-Host

Write-Host ""

Write-Host "1. Press ‘1’ to attach and upgrade a 2007 database";

Write-Host ""

$input = Read-Host "Enter a number for an option"

switch ($input)

{

"1" {UpgradeDatabase}

}

}

function UpgradeDatabase()

{

$webAppUrl = Read-Host "Web application URL"

$contentDbName = Read-Host "Content Database Name"

$webApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup($webAppUrl)

Write-Host "Mounting database $contentDbName";

Mount-SPContentDatabase -Name $contentDbName -WebApplication $webApp

Write-Host "Mounting complete";

$contentDb = Get-SPContentDatabase -Identity $contentDbName

Write-Host "Applying Corrective Action";

ApplyCorrectiveChanges $contentDb

}

 

As with using the Mount-SPContentDatabase PowerShell command the UI will request the following variables, being web application and Content Database Name to get started. But as mentioned if you loop through this you’ll be able to iteratively do your entire set of site collections (obviously if there are no hiccups along the way)

September 12, 2012 / red1s

Quick Tip – Alert me Missing in SharePoint 2010


If the alert me is missing from your SharePoint 2010 Ribbon:

clip_image001

You’ll need to update the Outgoing Mail in your Central Admin

Under System Settings- Configure Outgoing e-mail settings:

clip_image002

Make sure to provide an Outbound Server:

clip_image003

Once you click OK and browse back to the list you will see the ‘Alert Me Link appear in the ribbon:

clip_image004

September 3, 2012 / red1s

SharePoint 2010 Error – One or more field types are not installed properly. Go to the list settings page to delete these fields


If you receive the following error after attempting to access Site manager after upgrading your site collection / SharePoint site :

clip_image001

Then go to Site Settings-> Site Collection Administration-> Site Collection Features

De-activate “SharePoint Server Publishing Infrastructure”.

 

clip_image002

You’ll notice there is a ‘no title’ item in the list:

image

Delete the relations list @ – Relationships%20List/AllItems.aspx

Go back to your site collection features and activate SharePoint server publishing infrastructure features

clip_image004

If you get the following error when attempting to activate the site:

clip_image005

Run the following command to forcefully start it:

image

What’s interesting is it wasn’t started when I rechecked….however if you click reactivate it it starts :-)……must be a bug!

Go back to the Relationship list and you’ll now notice a GroupGUID:

clip_image007

 

You can now browse back to the  site explorer page and it should now work correctly Smile

 

 

References:

http://mssharepointlearnings.blogspot.com/2011/02/sitemanageraspx-one-or-more-field-types.html

http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?ID=353

http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/150aca88-c32c-4dbf-9f79-638ae438d1a0

http://sharepoint.microsoft.com/blogs/GetThePoint/Lists/Posts/Post.aspx?ID=353

August 23, 2012 / red1s

Search 2010 not working after Content Database migration


In this I’ll be addressing the search crawling not working after migration of content.

After migrating a content database and re running the search crawl the following search type error came up in the event log:

The start address http://siteadress cannot be crawled. Context: Application ‘Search_Service_App_1’, Catalog ‘Portal_Content’ Details: The protocol handler cannot be found. Check that the handler has been installed. (0x80040d1a)

I came past a few solutions, however the one which seemed to work is as follows:

  1. Go to Services on your SharePoint server (type "Services.msc" in command prompt and press  ‘Enter’)

2 – Stop the following services:

SharePoint server search 14

SharePoint Foundation Search

& SharePoint 2010 Timer service

clip_image001

Note: there might be other services if FAST search is enabled in the environment

3. Start all the 3 services again.

4. Reset the IIS

This seems to have been a problem in 2007 as well (see reference sites)

References:

Pasted from <http://sensoft2000-sharepoint.blogspot.com/2009/12/error-protocol-handler-cannot-be-found.html>

http://mariuszgorzoch.wordpress.com/category/sharepoint/

The following was a Red herring, but might prove useful to others:

MOSS Search Issues related to User Profile for Service Account

http://oidatsmyleg.wordpress.com/2011/07/21/moss-search-issues-related-to-user-profile-for-service-account/

August 22, 2012 / red1s

Running STSADM from within PowerShell


 

I’ve come to use and love PowerShell more and more over time, however still find my self remembering STSADM commands (and wanting to use it) pretty much- (backup/restore, etc.) …

A colleague of mine mentioned that this is possible and after some searching I found the following command which can be used to do trust this – it allows you to call stsadm command s from within PowerShell (for the old skool SP Admins out there)

Set-Alias -Name stsadm -Value $env:CommonProgramFiles”\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE”

clip_image001

Thanks to SharePoint Nomad for pointing this one out: http://sharepointnomad.wordpress.com/2009/12/30/calling-stsadm-from-within-a-powershell-script/

Happy ‘STSADMing’!

August 16, 2012 / red1s

SharePoint 2010 Missing Site Definition Error


During an upgrade process I came across the following error which seemed to have halt the upgrade process and disallowed the overall content of the site to be migrated across:

Category : MissingSiteDefinition

Error : True

This was encountered after running a test-spcontentdatasbe command against an exported content database

PS C:\Users\$HP_IDPDEVAPP_SVC> Test-SPContentDatabase -Name FARM_ZA_<CONTENT DB>

_CONTENT_DB -WebApplication .local">http://<site2010>.local

Category : MissingSiteDefinition

Error : True

UpgradeBlocking : False

Message : 1 Sites in database [FARM_ZA_<CONTENT DB>] has ref

erence(s) to a missing site definition, Id = [9003], Lcid = [

1033].

Remedy : The site definitions with Id 9003 is referenced in the databa

se [FARM_ZA_ANGLODOC_KIO_CONTENT_DB], but is not installed on

the current farm. The missing site definition may cause upgr

ade to fail. Please install any solution which contains the s

ite definition and restart upgrade if necessary.

I then investigate by running the following command against the webs table in the relevant database:

select fullurl from webs where webtemplate = ‘9003’

It turns out that this entry existed for the main site.

I checked the xml folder based on the info in the following link : http://msdn.microsoft.com/en-US/library/aa543837.aspx

Which instructs you to copy / duplicate the files (site templates) from the 12 hive into the equivalent 14 hive folder

However upon further investigation this site template wasn’t found.

The next step based on these articles would have been to delete the sites in question – however due to this being a root site this would not be possible:

Note the following is unsupported by MS:

I then decided to rename the site template with a template id I knew was there (being 9000) in this case i

I retested the content database ….and Voila! …the site definition error had disappeared.

Upon mounting the database the site upgraded successfully and was fully accessible.

Upon updating the masterpage all was in order and the site was successfully upgraded!

Reference sites

http://justgeeks.blogspot.com/2012/06/resolving-missing-references-when.html>

http://sharepoint-sandbox.com/index.php?/Tips-and-Tricks/Development/tip-41-how-to-find-the-site-definition-being-used-for-a-site.htMl

http://msdn.microsoft.com/en-US/library/aa543837.aspx

http://support.microsoft.com/kb/954761

http://blog.blumenthalit.com/default.aspx

http://social.technet.microsoft.com/Forums/en-US/sharepoint2010setup/thread/5dc3b69b-e8f5-4cec-be64-17f64b84c6a3/

August 8, 2012 / red1s

Cannot connect to database master at SQL server at <sql server name>


If you get the following error when running the SharePoint 2010 configuration wizard :

image

Cannot connect to database master at SQL Server at <SQL Server name>. The database might not exist, or the current user does not have permission to connect to it.

This is a combination of two issues which I faced

1 – Firewall issues

2 – Insufficient SQL permissions on the user running the Configuration wizard

Allowing the SQL machine to be accessed through the Firewall :

clip_image002

clip_image003

Section 2 – Ensuring that the user running the configuration wizard has sufficient permissions

As well as making sure that the user who will be specified for the Database access account has sufficient privileges, you will need to also ensure that the user running the configuration wizard has at least db_secutirytadm in and db _creater permissions accessible(in the below image I have specified db_owner to give full access as a testing method )

image

References:

http://social.msdn.microsoft.com/Forums/en/sharepoint2010general/thread/f789caed-b19c-4b98-94ae-713cd11b02df

http://blogs.technet.com/b/tothesharepoint/archive/2011/01/12/troubleshooting-sharepoint-configuration-error-cannot-connect-to-database-master-at-server-name.aspx

%d bloggers like this: