Multiple Backups from a Windows 2011 SBS to a network share

Wondering how to create a multiple backup for a windows 2011 SBS using the windows backup solution. To create a multiple backup solution you need some scripting and the use of taskmanager in Windows 2011 SBS or Windows 2008 Server R2.

You need to open Notepad and configure information like below.

@echo off
:: <filename>.cmd
:: Backup of my supersystem using WBADMIN.EXE
:: Made by .... yourname ....

rem backup share UNC
set backupshare=\\<networkdevice>\<backupshare>\<foldername>

rem files and folders to include
set include=< your partitions like d:, e: >

rem define date time variables for building the folder name
set m=%date:~6,2%
set d=%date:~3,2%
set y=%date:~9,4%
rem set h=%time:~0,2%
rem set min=%time:~3,2%
rem set sec=%time:~6,2%

rem defining a new folder like \\<networkdevice>\<backupshare>\<foldername>\<date>
set newfolder=%backupshare%\%computername%\%d%%m%%y%
echo Creating %newfolder%

mkdir %newfolder%

rem run the backup
echo Backing up %include% to %newfolder%
wbadmin START BACKUP -backuptarget:%newfolder% -include:%include% -allCritical -vssFull -quiet

Save the file to a <filename>.cmd in a folder that is easily to find back. Test the script via the Command line [ CMD] with administrative rights [ Run as administrator]

If the script run fine you can use the windows taskmanager to run the script daily.

14 thoughts on “Multiple Backups from a Windows 2011 SBS to a network share

  1. Thank you for this effort, I really appreciate someone has made this because Microsoft not making support for the network storage backups is just ridiculous.
    I edited your script to my needs and it worked one time but when I tried to run it the second time before I made an scheduled task from it it didn’t work anymore and I got a message saying: “An attempt to retrieve the properties for the template failed because the template in not in the catalog”
    Any ideas why it won’t work anymore?
    My script looks like this:
    @echo off
    :: backup.cmd
    :: Backup of Fujitsu Primergy TX150 S7 using WBADMIN.EXE
    :: Made by …. Marcus G ….

    rem backup share UNC
    set backupshare=\\NASQ700\Qbackup_server

    rem files and folders to include
    set include=c:,d:

    rem define date time variables for building the folder name
    set m=%date:~6,2%
    set d=%date:~3,2%
    set y=%date:~9,4%
    rem set h=%time:~0,2%
    rem set min=%time:~3,2%
    rem set sec=%time:~6,2%

    rem defining a new folder like \\\\\
    set newfolder=%backupshare%\%computername%\%d%%m%%y%
    echo Creating %newfolder%

    mkdir %newfolder%

    rem run the backup
    echo Backing up %include% to %newfolder%
    wbadmin START BACKUP -backuptarget:%newfolder% -include:%include% -allCritical -vssFull -quiet

    Also I have another question, when the space starts to run out from the network share location that I have configured to be the destination for the backups, will it automatically start overwriting older backups or can I somehow limit the number of saved backups?
    I really don’t understand much from the scripts I just copied what you made, thanks.

    -Marcus

    • When you start the script in a CMD mode with administrator rights. Do you get some errors? Maybe due those errors it doesn’t work.
      I had some issues too and via the CMD I found the issue and solved it.

      Fred

      • I have only used the command in CMD mode with administrator rights and the first time it worked and the second time I tried it I got the message: “An attempt to retrieve the properties for the template failed because the template in not in the catalog”

        I have made backups with the Windows Server Backup program(backup once method) I don’t know if this is causing the error.

        -Marcus

      • Hmm okay the error I haven’t seen before. I’ve no possibility right now to test it at the moment I can see if I can do it tomorrow at my work.
        Sorry i missed the other question about running out of space. you could create a script that deletes the folders after a certain period. that you run before the backup script is going to run.

        I run the task with scheduled tasks, you won’t need the windows backup console to run it. It will show the result..
        Hope this last part with scheduled tasks will help.

        Fred

      • Ok, thanks for the help.
        I notised the backup shows up in the results yes.
        I was also wondering if this script always makes new folders when making backups does it always make full backups, instead of incremental like the server backup program?

        I was thinking of making the delete script, but like I was saying earlier I don’t really understand it so I don’t have the skills to make one.

        -Marcus

      • I have something in mind, but I’ve to think and test it if it would work. The easiest way is delete everything from the folder but than you don’t have a backup for the last few days. What I could create is a script with a solution that it deletes on week number and it creates a new folder.

        – the script deletes the last WEEK Folder ( example WEEK8 )
        – the script renames the current folder ( with the name WEEK1 ) into WEEK2 > this continues into the WEEKx * for example 8 weeks ( 2 months ) *
        – the script makes a new folder with the name WEEK1
        – after this you need to run this script only 1 week. and you can see and edit the script to the correct schedule that you don’t have issue with your disk space.

        I will post tomorrow the script for weeks and the deletion of a week.

      • Hello Marcus,

        you could make a move script like this.

        @ECHO —–CHANGE DIR —-
        NET USE B: \\BACKUPLOCATION\BACKUP

        @ECHO —- REMOVE OLD WEEK —-

        B:
        CD\
        IF EXIST B:\WEEKX RMDIR WEEKX /S /Q

        @ECHO —- RENAME WEEKS —-

        B:
        CD\
        RENAME WEEK4 WEEKX
        RENAME WEEK3 WEEK4
        RENAME WEEK2 WEEK3
        RENAME WEEK1 WEEK2
        MD WEEK1

        CD\

        @ECHO —- DELETE SHARE —-
        NET USE B: /DELETE /YES

        I hope this will help you with your backup solution.
        Fred

  2. Hi,
    I’m getting the same error:
    An attempt to retrieve the properties for the template failed because the template is not in the catalog.

    any advice please,

    • The backup isn’t created via the windows sbs console. you will see only in the sbs console if the backup is failed or succeeded.

      ( you may see the properties via the windows backup solution ( via administrative tools ))

  3. Hiya,
    I can’t seem to figure out something. How can I only save contents of one drive like d: or e: etc. Everytime I replace the line:

    set include=

    with

    set include=d:

    it still says that it is saving c:, d: and e:

    Many Thanks.

    • c drive is included because of the -AllCritical option.
      it’s weird that the e: drive is included. Maybe you have to tray the letter with out the colon :

  4. Even if I use the colon :, I still get the status message that it is saving RECOVERY Partition c: and d: drive as well.

    • Omar,
      If you leave the line

      rem files and folders to include
      set include=

      empty than the backup will do only the full c:.
      You don’t need to set the c: in this line.

      if you set

      rem files and folders to include
      set include=d:

      it suppose to add only the d: and not the other partition.
      The c: is an critical drive (if you don’t want to add this remove the -AllCritical from the script.)

      maybe you can post your script to see what’s going one.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s