Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Script to schedule network backup and retention

20 Apr 2011   #1

Windows 7 Pro x64
Script to schedule network backup and retention

Using Windows 7 / 2008 built in backup utility replacing NTBAckup it's no longer possible to backup to a UNC path from GUI, however with wbadmin command it is..

Having tried this it seems to work ok but each backup overwrites the contents of the previous one but leaves date in the foldername the same..

I think a way to get around this would be to move, at the end of each backup, the files from destiantion into another folder so the next time it executes it creates a brand new correctly dated folder.

I could then run another script to remove old backups automatically.

This is my rough batch file but I guess could be improved:
1) Do you see any errors in this syntax?
2) Is there a better way of doing any of this
3) Do I need to include the date/unique ID in destination folder so Catalog folder and MediaID files aren't overwritten daily (how?) or does it not matter if they are?

rem use Win 2008 wbadmin to backup server to UNC path 
wbadmin start backup -include:c:,d: -backupTarget:\\destpath\servername -quiet>>C:\Win2008_Backup_Script\backup_log.txt

rem  robocopy to move daily backup to subfolder named date.
robocopy /MOVE \\destpath\servername\WindowsImageBackup\servername \\destpath\servername\Daily_Mo-Th\%date% z /e /log+:C:\Win2008_Backup_Script\robocopy_log.txt /w:5 /r:20 /np /eta 

rem remove files older than two weeks
forfiles /p \\destpath\servername\Daily_Mo-Th\ /s /m *.* /d -10 /c "cmd /c del @file : date >= 14 days"

My System SpecsSystem Spec
24 Apr 2011   #2

Windows 10 Pro/ Windows 10 Pro Insider

I don't know if I can help as I am not familiar with backing up to a server. However, the way you explain it it basically works the same as it does for regular home backups. If I backup to an external hard drive it will overwrite the previous image. To resolve that if you want to keep multiple backups you can move the backup to a different Hard drive, you can put the backup into a folder, or to me the simplest way is to rename the backup. When the backup runs it will be Windowsimagebackup. I simply rename it to the date ie. 4-23windowsimagebackup. It will then run a new backup. That way you can select which backup to restore. The only thing to rememeber is to restore the backup you have to name it back to the original name. I hope this helped some.
My System SpecsSystem Spec

 Script to schedule network backup and retention

Thread Tools

Similar help and support threads
Thread Forum
Backup Schedule
I'm getting a new Laptop next week with Win 7 Home Premium 64 Bit (OEM) I've been reading up about Back up and Restore If I want to Backup a System Image or Data Files, can I do this as and when I want to or is setting a Schedule compulsory? The reason for my question is that I want to...
Backup and Restore
Schedule multiple backup jobs?
As per the title, I'd like to schedule multiple backup jobs; I don't see how to do this with W7's built-in backup utility. I have copied NTBACKUP and it's two associated .dll's from an XP box to my W7 system; ntbackup runs if activated manually but scheduled tasks don't run. Advice on how...
Backup and Restore
Can't Create Backup Schedule
Greetings, I am constantly creating a backup schedule to perform a backup every Monday at 7 pm. The "Next backup" correctly shows the date and time for the following Monday, and "Last backup" shows the correct date and time for last Monday. However, every time I reboot, the "Next backup" date...
Backup and Restore
Is Backup Schedule just for File backups?
I am trying to determine what the use of the backup section of the Back up and Restore screen is for. Is it just for doing file backup or is it intended to be used also for Full System Image backups also?
Backup and Restore
Can you schedule disk imaging like you can with backup?
Just wondering if this can be done in the background on a regular schedule, either via Windows Backup or a third party program. And if it can be does it require a deletion/re-imaging of the old file, or can it just tack on whatevers changed/added to it? This part is important, as I would'nt have...
Backup and Restore

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 17:42.
Twitter Facebook Google+