Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.
Microsoft cloud engineer - SharePoint, Office 365, Azure, DotNet, Angular, JavaScript.

Upgrade

SharePoint 2013 upgrade QA with HTTP homepage checks

After upgrading it can be smart to run Quality Assurance checks.   Microsoft gives us Test-SPContentDatabase for post upgrade scanning.   I wanted to take that one step further and simulate user visits to every site homepage.   If the HTML response contains an error keyword then we’ll research those URLs further and dig into root cause.

If a SharePoint site homepage won’t load that creates a road block where users aren’t able to navigate Lists, Libraries, Settings, etc. to even troubleshooting the issue. 

By simulating HTTP visits to every site homepage we can increase upgrade quality with higher confidence that users can continue working uninterrupted.   Knowing that all homepages gave HTTP 200 with a clean page title is a great way to complete any upgrade.   Hope you found this helpful!    

shades_smile

 

QA Checks

  1. Page title contains “error”
  2. Page HTML source contains “Correlation ID”
  3. Page HTML source contains “Microsoft.Office.DataParts” assembly name

 

CSV Output

image

 

Screenshots

1-14-2015 11-44-33 AM
3

 

Code

#declare functions
Function HttpQA($url, $type) {
	#create web request
	$res = Invoke-WebRequest $url -UseBasicParsing -UseDefaultCredentials
	#parse 
	$statuscode = $res.StatusCode
	$a = $res.Content.indexOf("<title>")
	$b = $res.Content.indexOf("")
	$title = $res.Content.Substring($a+7,$b-$a-7).Trim().replace(([char]13).ToString(),"").replace(([char]10).ToString(),"")
	
	#parse Correlation ID
	$a = $res.Content.indexOf("Correlation ID:")
	if ($a -gt -1) {
		$corrpage = $res.Content.Substring($a+15,37).Trim().replace(([char]13).ToString(),"").replace(([char]10).ToString(),"")
	}
	
	#parse assembly name "Microsoft.Office.DataParts"
	$owc = $res.Content.indexOf("Microsoft.Office.DataParts")
	if ($owc -gt 0) {$owcfound = $true} else {$owcfound = $false}
	
	#HTTP headers
	$corrhead = $res.Headers["SPRequestGuid"]
	$sper = $res.Headers["SharePointError"]
	if ($sper) {$sperfound = $true} else {$sperfound = $false}
	
	#format output
	$f = $s.Url -replace("/","-")
	$global:coll += New-Object -TypeName PSObject -Prop (@{"Type"=$type;"URL"=$url;"HTTP"=$statuscode;"Title"=$title;"CorrelationIDPage"=$corrpage;"OWCFound"=$owcfound;"SharePointError"=$sperfound;"CorrelationIDHeader"=$corrhead});
}
#configuration
$sites = Get-SPSite -Limit All | Get-SPWeb -Limit All
$c = $sites.Count
$i = 0
$global:coll = @()
#loop each site
foreach ($s in $sites) {
	#display progress
	$i++
	$surl = $s.url
	Write-Progress -Activity "HTTP test " -Status $surl -PercentComplete (($i/$c)*100.0)
	
	#run HTTP tests
	HttpQA "$surl" "HomePage"
	HttpQA "$surl/_layouts/viewlsts.aspx" "Viewlsts"
}
#save results
$global:coll | Export-Csv http-qa.csv -NoTypeInformation

Wrap Test-SPContentDatabase with database name

 

While testing an upgrade to SharePoint 2013 I wanted to review missing server dependencies.   Test-SPContentDatabase does a great job.   However, it doesn’t output the SQL content database name.   That makes it hard to read output on a large farm with many content databases.   By leveraging a custom variable for database name we can augment output with an additional column showing the parent database name for each issue.    Hope you find this helpful!   

shades_smile

 

Code

Get-SPDatabase |? {$_.Type -like 'Content*'} |% {$n=$_.Name; $_} | Test-SPContentDatabase | Select *,{$n}

 

References

NEW CodePlex project – SPUpgradeHelper

Today I am happy to announce https://spupgradehelper.codeplex.com/ is available for download.   This project aims to smooth the “double hop” upgrade from MOSS 2007 to SP2010 to SP 2013 by reading a CSV of database targets and automating the Cmdlets needed for a consistent, repeatable, high quality, and fast process.   Please leave a comment here or on CodePlex if you found this helpful.  Cheers! 

shades_smile

 

Project Description

Migrating MOSS 2007 to SP 2013? This script takes a CSV of databases and runs upgrade Cmdlets in bulk (DB version/Mount/Dismount/Upgrade-SPSite/Claims auth)

Upgrading MOSS to SP2013 is a tedious process with many Cmdlets, especially if you have many databases. This script aims to help automate that process.

Given a CSV with SQL instance and content database names, this script offers Cmdlets to run upgrade steps across many databases all at once. No more TXT or XLS copy and paste madness. Simply populate the CSV, get familiar with UH* Cmdlets and upgrade with ease.

Key Features

  • Read CSV of databases
  • Load helper functions into memory
  • Enable admin to more easily run Cmdlets in bulk
  • Measure time duration for each step (# minutes)
  • Provide detailed LOG file of actions, result, and duration

Quick Start Guide

  • Extract “SPUpgradeHelper.ZIP” to any SharePoint machine in your farm
  • Run “SPUpgradeHelper.ps1” to load helper functions
  • Type in full path to your CSV file (i.e. “C:\TEMP\COLLAB.CSV”)

Function Names

  • UHCIaims – execute SPWebApplication function to upgrade Classic to Claims auth
  • UHCompatibiIity – execute Get-SPSite for “set” of databases to show GUI version (14/15)
  • UHDBVersion – execute TSQL for “set” of databases to show build number (12.0, 14.0, 15.0)
  • UHDismount – execute DisMount-SPContentDatabase for “set” of databases
  • UHMount – execute Mount-SPContentDatabase for “set” of databases
  • UHReadCSV – load CSV file into memory with upgrade “set”, SQL instance, and database names
  • UHUpgrade – execute Upgrade-SPSite for “set” of databases

NOTE – Upgrade “set” is meant for running parallel workstreams. For example, two servers with SP2010 and two servers with SP2013. That way overall upgrade can be expedited by running database set “A” through the first SP2010 and SP2013 server while database set “B” runs on the second server.

Microsoft Upgrade Process

FIXED BDC – Database is in compatibility range and upgrade is recommended

I noticed the message “BdcServiceDatabase – Database is in compatibility range and upgrade is recommended” in Central Admin.   This often seems to come up after applying a CU patch.

The fix was just to run a quick PowerShell line to upgrade the database.  Here it is for reference.  Cheers! 

shades_smile

 

(Get-SPDatabase | ?{$_.type -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceDatabase"}).Provision()

 

image

 

image

© Copyright 2016
@ SPJeff

Return to Top ▲Return to Top ▲