This is not really the answer to your questions, but you can do it directly in SqlServer 2005 with a maintenance plan (Object Explorer → Management → Maintenance Plans).
Typically, I create one Maintenance Plan that includes two tasks: One “Maintenance Cleanup Task” that deletes old backups after x days, and then “Database Backup Task”.
source
share