Making a Change Log Easier With PowerShell

Having a Change Log is a good thing. A quick and simple place to find out what has changed on a server and when. This can be invaluable when troubleshooting, matching a change to a symptom especially when assessed alongside your performance counter collection. Here is a simple way to make use of a change log and automate it

Create a simple table

You can keep this on a central server or create a database on each server, whichever fits your needs best. You can add other columns if you want your information in a different format

Once you have your table you can create a couple of Powershell functions to easily and quickly add to and retrieve data from the table. I make use of Invoke-SQLCMD2 in these functions

This can then be included in any automation tasks that you use to update your environments whether you are using automated deployment methods for releases or using SCCM to patch your environments making it easy to update and also easy to automate by making it part of your usual deployment process.

To add a new change

You can then run

to add the change to the change log

To retrieve the data you can use

and use

To find out what changed when. Happy Automating

3 thoughts on “Making a Change Log Easier With PowerShell

  1. Pingback: Installing and upgrading default scripts automation – part one – Introduction « SQL DBA with A Beard

  2. Pingback: Installing and upgrading default scripts automation – part one – Introduction - SQL Server - SQL Server - Toad World

  3. Pingback: Populating My DBA Database for Power Bi with PowerShell – Databases | SQL DBA with A Beard

Please feel free to comment on this post. All comments are moderated first before appearing on the site