W2K8 – Automatic deploy for Native backup


Need a solution to easily deploy a native backup job on multi W2K8 R2 servers. after asking google and testing, a simple script is out with combining the multi cmds (diskshadow, vssadmin, wbadmin,etc). 2 points here

1. no command able to enable “Run on Demand” on the schedule task

2. “-allCritical” is for the Bare Metal backup, and have to backup all Critical Volumes. If any volume (i.e E:) is used for SQL DB logs or database, then it will be considered as “Critical Volume”. Stupid Microsoft, why treat such volume as Critical? We did not use “SQL Writer service” for DB backup.

REM E:\Scripts\OS\OS-Backup.cmd

REM Delete all shadow copies

diskshadow -s E:\scripts\OS\DelShadows.txt

pause

REM delete the existing catalog. this will also delete the existing backup schedule task

wbadmin delete catalog -quiet

pause

REM delete all backup files on volume X

rmdir X:\WindowsImageBackup /s /Q

pause

REM Resize the max of storage space for shadow copy storage on Volume X to 2GB

vssadmin resize shadowstorage /for=X: /On=X: /maxsize=2GB

pause

REM Enable schedule backup @ 01:00 daily

wbadmin enable backup -addTarget:X: -include:c:,e:\392 -systemstate -allCritical -vssFull -schedule:01:00

REM Enable Run on Demand

REM Have to manually enable it via UI – unable to find out a script way

REM Auto Run the backup on Demand

REM Schtasks /Run /TN “\Microsoft\Windows\BackupMicrosoft-Windows-WIndowsBackup”

Advertisements
Aside | This entry was posted in W2K8. Bookmark the permalink.

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