Welcome to MSDN Blogs Sign in | Join | Help

SQL 2008 Power Shell script - Databases that were not backed up in last 7 days

a) Install SQL Server 2008. You can get RC0 from here: Download SQL 2008 RC0

b) Launch SQL Server Management  Studio ( Start -> All Programs -> Microsoft SQL Server 2008 -> SQL Server Management Studio)

c) Connect to SQL Server instance, Right click on the server node in Object Explorer and click on "Start Power Shell" menu

LaunchPowerShell

d) Get the list of all databases on this instance

dir Databases

 

ListAllDatabases

e) Get the list of databases that were not backed up in last 7 days

dir Databases | where-object { $_.LastBackupDate -le [DateTime]::Now.AddDays(-7)}

DatabaseNotBackedUpLastweek 

 

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Published Tuesday, June 10, 2008 12:53 PM by Sethu Srinivasan

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker