0% found this document useful (0 votes)
83 views

Automate Windows Server Backup Using Diskshadow and Rsync

This document describes how the author automated backups of Windows servers to a Network Attached Storage (NAS) device using DiskShadow and Rsync. DiskShadow is used to create shadow copies of volumes which are then exposed and synchronized to the NAS using Rsync. A PowerShell script runs the DiskShadow and Rsync processes daily and emails a backup report. This provides an offsite backup solution for Windows servers that replicates changes to the NAS location.

Uploaded by

ovidiutache
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views

Automate Windows Server Backup Using Diskshadow and Rsync

This document describes how the author automated backups of Windows servers to a Network Attached Storage (NAS) device using DiskShadow and Rsync. DiskShadow is used to create shadow copies of volumes which are then exposed and synchronized to the NAS using Rsync. A PowerShell script runs the DiskShadow and Rsync processes daily and emails a backup report. This provides an offsite backup solution for Windows servers that replicates changes to the NAS location.

Uploaded by

ovidiutache
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

IAN WORKS ABOUT

HERE

Reminding myself how i did it last time …

AUTOMATE WINDOWS SERVER BACKUP Search this site...

USING DISKSHADOW AND RSYNC …


R E C E NT POS T S

2014/03/20 · by ianworkshere · in Backup · Leave a comment


List of backup solutions for
We have a number of Netgear ReadyNAS devices across our offices. All of these VM’s on both the paid and
run nightly Rsync backup jobs back to a ReadyNAS 516 in head office. The 516
free ESXi …
device also does a daily snapshot of the shares. Note that as most of our offices
Server naming
utilise ADSL, we had to manually transport a copy of the data to head office.
Now the backup jobs just synchronise changes. This works reasonably well and conventions …
provides some rudimentary historical offsite backup for the remote offices. Update Deltacopy rsync to

resolve long file name


It proved somewhat more difficult to work out how to achieve the same result
with our Windows Servers. These are primarily 2008R2 but we still have 1 x issues …
2003 and 1 x 2012R2. Change Local Administrator

password complexity
I had a look at variety of programs such as DeltaCopy and Yintersync but could
requirements …
not seem to get them to talk to the ReadyNAS Rsync server. Or get the
ReadyNAS to talk to them. Yintersync looked really interesting but did not Samsung Galaxy s4 (Telstra)
seem to suit my set up with the NAS devices. Also, I was not sure how these Update to Android 4.3 breaks
would work with open files such as Exchange and SQL Server database files.
WIFI …

Eventually, I stumbled across this page:


R E C E NT C OM M ENTS

http://web.aboutmyx.com/app? ianworkshere on
operation=forum&st=viewOneArticle&id=1223 Netgear GS724Tv1
Firmware Upgr…
This seemed to offer an interesting option. Not having done much with Marcel on Netgear
shadow copies, i soon discovered that since Server 2008 (i think), DiskShadow GS724Tv1 Firmware
is now the command-line tool for working with shadow copies. Upgr…
SutoCom on Active
http://angrytechnician.wordpress.com/2011/02/23/vssadmin-is-dead-long- Directory Single Sign-
live-diskshadow/ O…
SutoCom on
http://social.technet.microsoft.com/Forums/windowsserver/en- Sharepoint and
US/506855d1-21a4-4302-918a-5c9a503be1ae/where-is-a-vshadowexe-for- Windows Azure I…
windows-2008-r2?forum=winservergen subnaturald on OTRS
and Active Directory…
http://technet.microsoft.com/en-us/library/cc772172%28WS.10%29.aspx

Anyhow, to cut a long story short, I ended up with this DiskShadow script,
A R C H IV E S
imaginatively called “DiskShadowScript.cmd”:

September 2014

#DiskShadow script file August 2014


set context persistent nowriters
July 2014
set metadata C:\BW\DiskShadowBackup\example.cab
set verbose on March 2014
begin backup
October 2013
add volume c: alias SystemVolumeShadow
create September 2013
expose %SystemVolumeShadow% x:
June 2013
exec C:\cwRsync\BackupScript.cmd
unexpose x: May 2013
end backup
March 2013
#End of script

CAT EG OR I E S

You will notice that this calls an rsync script to synchronise the shadow copy
Active Directory
with the rsync server. This is the rsync script minus the incriminating details:
Backup

CAD
C:\cwRsync\rsync.exe -rltv --exclude-
from="/cygdrive/C/cwRsync/ExcludePatterns.txt" --log- Database
file="/cygdrive/C/Logs/Rsync/BackupScript.log" "/cygdrive/X/" "ip-
Email
address::backup-mel/sp1/C/"
Exchange

Firewall
Obviously, we replace ‘ip-address’ with an actual ip address like 192.168.0.254.
GIS

You will also see that I am using rsync from cwRsync. This is the free version Helpdesk
available here: Networking

Password
https://www.itefix.no/i2/cwrsync
Policy
I’m tossing up whether to purchase the other one but not sure if I need the Security
extra features and support etc.
Sharepoint

Standards
I then wrapped this up in a PowerShell script that sends me an email when
finished, with the backup log attached. I schedule this to run daily using the Storage
 Follow
Windows Task Scheduler. Here is the PowerShell script: Uncategorized
Follow “Ian Works
Virtualisation
Import-Module C:\BW\Powershell\Modules\SendMail
Here”
# Create a disk shadow and rsync to Melbourne M E TA
Get every new post delivered
DiskShadow /s "C:\BW\DiskShadowBackup\DiskShadowScript.cmd"
to your Inbox.
#
Register
# Set up email Enter your email address
$dtToday = ((Get-Date).dateTime).tostring() Log in
$strSubject = "SP1 Rsync Report - $dtToday"
Entries RSS
$strBody = "report attached." Sign me up
$strSender = "noreply@domain" Comments RSS
$strRecipient = "me@domain" Build a website
Create a freewith WordPress.com
website or blog
$Attachment = "C:\Logs\Rsync\BackupScript.log"
# Send the email at WordPress.com.
SendMail $strSubject $strBody $strSender $strRecipient $Attachment

The ‘SendMail’ is a function defined in a module. Here is the module:

Function SendMail($strSubject, $strBody, $strSenderEmail,


$strRecipientEmail, $AttachFile)
{
$strSMTP = "smtp-server" #Change this to your SMTP/Exchange server
$MailMessage = New-Object System.Net.Mail.MailMessage
$SMTPClient = New-Object System.Net.Mail.smtpClient
$SMTPClient.host = $strSMTP
$Recipient = New-Object
System.Net.Mail.MailAddress($strRecipientemail, "Recipient")
$Sender = New-Object System.Net.Mail.MailAddress($strSenderemail,
"Sender")
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.Subject = $strSubject
$MailMessage.To.add($Recipient)
$MailMessage.Body = $strBody
if ($AttachFile -ne $null)
{$MailMessage.attachments.add($AttachFile) }
$SMTPClient.Send($MailMessage)
}

The PowerShell scripts were basically copied from these pages with some
modification:

http://ss64.com/ps/syntax-email.html

http://gallery.technet.microsoft.com/scriptcenter/Simple-Powershell-
function-8e826d7c

http://blogs.technet.com/b/heyscriptingguy/archive/2012/08/11/weekend-
scripter-use-the-windows-task-scheduler-to-run-a-windows-powershell-
script.aspx

http://technet.microsoft.com/en-us/library/hh847804.aspx

http://community.spiceworks.com/how_to/show/17736-run-powershell-
scripts-from-task-scheduler

Thanks again to all those that take the time to blog or post on the internet.

About these ads

You May Like

1. 5 Jobs
You'll Make $300k/yr From Home 2
months ago track.trkzlnk.com
WorthyTrend.com (sponsored)
(sponsored)
Share
Share this:
this:

 Twitter  Facebook 1

 Like
One blogger likes this.

Related

DiskShadow and Exchange NDR 5.4.6 List of backup


multiple VSS ... solutions for VM's on
Providers ... In "Email" both the paid and
In "Backup" free ESXi ...
In "Backup"

Tags: 2008, diskshadow, powershell, rsync, schedule, shadow copies, windows server

Leave a Reply

Enter your comment here...

← Netgear GS724Tv1 Firmware Upgrade … DiskShadow and multiple VSS Providers … →


Create a free website or blog at WordPress.com.
The Origin Theme.

You might also like