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!

QA Checks
- Page title contains “error”
- Page HTML source contains “Correlation ID”
- Page HTML source contains “Microsoft.Office.DataParts” assembly name
CSV Output

Screenshots


Code
#declare functions Function HttpQA($url, $type) { #create web request $res = Invoke-WebRequest $url -UseBasicParsing -UseDefaultCredentials #parse$statuscode = $res.StatusCode $a = $res.Content.indexOf(" ") $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