One of the current tools in my toolbox is Xenu Link Sleuth which does a great job of scanning through our site and finding links that are broken or need updating. Although while the report it gives is good to review afterwards it is difficult to send out to others, so to make the data useful to my business users I needed to make something that was more readable. Since PowerShell is something that we use often it seemed an easy choice to write something that reads through the exported data and generates a useful report.
# Crawl Report
$crawlReport = Import-Csv "" -Delimiter "`t"
$crawlList = @()
# Page Map
$siteMap = Import-Csv "" -Delimiter "`t"
$siteList = @()
# Links List
[string] $brokenLinksList = "BrokenLinksList.txt"
[string] $brokenLinksOverview = "BrokenLinksList.csv"
# Clean up from last time
if (Test-Path $brokenLinksList) {
Remove-Item $brokenLinksList -Force
}
if (Test-Path $brokenLinksOverview) {
Remove-Item $brokenLinksOverview -Force
}
"Just some initial information on what we are dealing with."
"Crawl Report is " + $crawlReport.Length + " lines."
"Site Map is " + $siteMap.Length + " lines."
# Check each Address that has a Status-Code of 404, add it to an array we will
# use to get its origin from the Site Map
foreach ($row in $crawlReport) {
if ($row.StatusCode -eq "404") {
$crawlList += $row.Address
}
}
"We now have " + $crawlList.Count + " broken links to deal with."
# Check in the Site Map for the Address as a Link to Page
foreach ($link in $crawlList) {
foreach ($line in $siteMap) {
if ($link -eq $line.LinkToPage) {
# Pull these together to make it simpler to review later on
$data = $link + "," + $line.LinkToPage + "," + $line.OriginPage
$siteList += $data
}
}
}
"Overall there are " + $siteList.Count + " broken links to fix."
# Output the Address, Link To Page and Origin Page to a separate file
# since these were put together as CSV's earlier let's just make an
# exported CSV file for ease of use later on
"BrokenLink,LinkToPage,OriginPage" >> $brokenLinksList
foreach ($entry in $siteList) {
$entry >> $brokenLinksList
}
# Now that we have everything in one file let's make it a CSV
$brokenLinksList | Export-Csv $brokenLinksOverview
This puts the data into a CSV file that can be filtered and sorted in Excel, which puts the data in a format that's more useful for my business users.
So, 2011 was a busy year working with SharePoint. We did a major site
upgrade where the old public site running on IIS was moved over to SharePoint,
that was a major effort and took a lot of coordination with a lot of people. It
came off really well, and has been successful since not many people noticed the
underlying change, only the new look of the site. To me, that is a major
success.
In addition I went through the task of learning SharePoint, as well as it's
Search functionality, we had it going well for awhile then things just stopped.
We still have no idea why, but it's been slightly educational in learning how
things work. A nice environment where people just jump into things, help out
where needed, and take the time to learn. That's what makes this job great.
Testing was a big focus, not only because we added a new person to help test
last year, though she moved on it was good to sort of settle things and document
much more. Teaching is always interesting since everyone comes in with a
different focus and idea, that helps me readjust my thinking when I start to
train someone. From that I have more wiki pages, more places to document what
we have been doing and more documentation on just everything. I also got a
start on automated testing, I now have a Framework with SpecFlow where I am now
using BDD to create automated cases for Functional and Acceptance testing.
First time the Acceptance Test was used after a deploy we found an error, that
is success to me.
I needed to add goals for the year, which I am bad at, for myself I have
overall goals but they get subsumed by whatever is going on at work at the
time. Priorities come up and I need to learn something, say about writing a
PowerShell script here or there, always something new. Though I think I am
better now at focusing more on what I need to do and I will be going through
that as a task for 2012. Should be an interesting year and I hope to do better
about recording things here as well.