• This is a good script script. I think it would be useful for checking for old backups as you suggest. Typically, we try to place backups we retain for multiple days in a specified folder we put on each system and then check the age there. Naturally, we may take backups and place them on drives and never go back to them, so this would be good for a one-off look for those "forgotten" backups that are no longer needed.

    Some recommendations:

    1. Change it to a stored procedure with the configurable values as input. When I first went to run it, I hadn't realized the configurable values section and had to look at the data types first to get it working.

    2. A minor recommendation, but have the default output changed to say "size_mb" instead of just size, output the number of days the file has been there (get the datediff comparing the file date versus today's date)

    3. Modify it to loop through all drives (maybe by combining its' use with xp_fixeddrives). This would be useful as an overall review of the system to check all drives to proactively look at the largest files of a certain type.

    Some people may also point out that xp_cmdshell and Ole Automation Procedures need to be enabled in order for the script to run, and there are some associated security risks with enabling those options.

    A generalized comment:

    With monitoring/cleanup scripts, I always try to take the mindset of "How can I run this on all of my SQL Servers/databases/disks/etc from a centralized location?" to help make my job easier.

    Hope that feedback helps you out for future submissions.

    Steve