Using PowerShell to work with SharePoint Databases – Series Preview

By | March 6, 2012

I’ve been working recently on a project where I’ve been much more “hands-on” than usual, working to deliver a full mutli-stage SharePoint platform that I designed last year for a client based in Canary Wharf.

One of the requirements gathered from the client can be best described as “simplicity in administration” – what do they mean by this?  They want minimal admin overhead associated to the day-to-day operations of the SharePoint farms, but don’t want to invest (at this time) in management products such as System Centre, which, at a high level, means one thing – lot’s of PowerShell scripts!

Why PowerShell scripts for databases?  To date, most of the mission critical applications within the client have run on Oracle and only non-core systems have been running on SQL Server, until SharePoint arrived and upset the apple cart.  With limited SQL Server skills in house at the client, I embarked on some exploration as to whether it would be practical to cover off a percentage of DBA tasks from within pre-defined, parameter/config file driven PowerShell scripts that could be run, as required, by the applications team to tide them over whilst they skill up on SharePoint and SQL Server.

Why practical you ask?  Well, we know its possible, interaction with SQL Server via PowerShell is (relatively) uncomplicated, but could we (in a practical sense) build out a flotilla of scripts that would meet our needs for database management in a reasonable timeframe and at reasonable “cost”.

This series of posts is the result of the exploration and will focus on different tasks and processes that have been scripted into PowerShell, enabling single point administration with relatively low skill/knowledge requirements.  Over the series we will look at:

  • checking for databases
  • creating databases
  • altering databases
  • backup of databases
  • moving databases
  • incorporating database operations into SharePoint automation scripts

Plus anything else I have the time to include.

The key aim for the series? Helping the reader get a good handle on the basics. Nothing too hairy or gnarly will be covered, I’m just hoping to fill a gap that seems to exist when Bingle’ing for information about bringing PowerShell, SharePoint and SQL Server together.

I’m hoping to knock out a post a week once the baby is born, but first some homework…

Spin up MSDN here and take a peek at the SQL SMO namespace for database engine objects (which includes objects such as instances, databases, tables, views, etc.) even a cursory glance at the namespace will set you up for a better understanding of what we will be interacting with in the series…

more to follow…

Leave a Reply

Your email address will not be published. Required fields are marked *