[ADSM-L] Powershell script for SQL backups?

2012-05-23 09:51:37
Subject: [ADSM-L] Powershell script for SQL backups?
From: "Schaub, Steve" <steve_schaub AT BCBST DOT COM>
Date: Wed, 23 May 2012 09:46:51 -0400
Before I reinvent the wheel, I thought I'd check to see if any out there has 
come up with a Powershell script for SQL-Server backups.

I want to convert from our old batch scripts and add the following capabilities:

1.       Pass a parm so one script can be used for either full, diff or log 

2.       Determine if the server is part of a cluster, and if the node is 
active (I find the official "cluster setup" of TSM very cumbersome, so we just 
perform a standard install on the cluster nodes and let the script determine 
whether or not to run a backup job)

3.       Enumerate and process all SQL Instances on the server (currently we 
use a hard-coded file on each server with the names of all the instances)

4.       Allow for the potential existence/use of 2 "exclude" files - one to 
exclude entire SQL Instances, and one to exclude specific databases.  The 
database file would allow for each database to specify the exclusion of full, 
diff or log backups (excluding fulls would automatically exclude diff & log).

5.       Enumerate and process all databases in the Instance (skipping excluded 

6.       Skip backup of any database according to these rules:

a.       Status not = "Normal" (e.g. offline or recovering databases)

b.      Database is a Mirror of another

c.       For Diff or Log backup, database is a SystemObject 

d.      For Log backup, RecoveryModel = "Simple"

I would be very interested in the techniques anyone is using within Powershell 
to accomplish any/all of these functions.

Steve Schaub
Systems Engineer II, Windows Backup/Recovery
BlueCross BlueShield of Tennessee

Please see the following link for the BlueCross BlueShield of Tennessee E-mail 

<Prev in Thread] Current Thread [Next in Thread>
  • [ADSM-L] Powershell script for SQL backups?, Schaub, Steve <=