Showing posts with label Restore. Show all posts
Showing posts with label Restore. Show all posts

Thursday, July 25, 2019

Veeam Backup Automated Data Restore Test From Backup



We've already gone through the automation of scheduled data restore in Symantec/Veritas using powershell.

If you haven't gone through please refer the article Symantec/VERITAS Scheduled Data Restore Test From Backup

Even though Veeam backup is featured with sure backup recovery verification, the below PowerShell script helps those who don't have license to enable this feature.

The script can be used to automate file/folder restore test from the Veeam backup and this test is performed to ensure that the data is recoverable from backup.


Pre-requisites


1. Windows Powershell version 4.0 or above

2. Ensure that Veeam backup powershell module installed in your backup server.

Reference : Veeam Backup Powershell - Get Start

3. Verify the name of server or servers in the veeam backup console those are selected for restore test.(it may case sensitive and must have to input into the script as it is).

4. Create a folder named “BackupTest” in the C or D drive of servers chosen for restore test and create another folder inside it, then add some files into it.(Total size of all files in the folder should be greater than 1 MB).















5. By verifying the backup job report ensure that the folder was successfully backed up in the last backup schedule.

6. Create a folder named “BackupRestoreTest” on the D or any drive of the veeam server.



How to use the PowerShell Script

STEP 1) Download the script “VB-Restore.ps1” from the GitHub and extract it to any drive. For example extract it to the D driver folder "BackupRestoreTest" in the veeam server

Github Link : Veeam-Data-Restore-Test



STEP 2) Edit following portion in the script.

#Edit this session

#The folder chosen for test restore from the server.

$Foldername = "D:\BackupTest\Data-Backup-Test\"

#The Server chosen for test restore

$Server = "Server01"

Note: Ensure that server name should be exact match with the name shown in the backup exec console.

Example: “Server01” or Server01.sjohnonline.in

#Data restore path

$Restorepath = "\\server01\d$\BackupTest\"


# The user account configured on veeam server which has privileged access.
# You can get this info using below commands in an admin powershell on veeam server

# Add-PSSnapin VeeamPSSnapin

# Get-VBRCredentials

# Pick the User Name : Domain\username

$Accountname = "DOMAIN\veeam_access"

#This is the name of the Backup Job

$Backupname = "Main Backup"

#Email address of sender

$FromAddress = "VBrestoretest@sjohnonline.in"

#Email address of recipient

$ToAddress = "sjohn@sjohnonline.in"

#Subject of the email

$Subject = "Veeam backup monthly scheduled backup-Restore Test"

#SMTP Server responsible for email service

$SMTPServer = "Enter SMTP server name or IP here"

#SMTP Server port number


$SMTPPort = “Enter the SMTP port number”


#Since Veeam backup powershell module doesn't support copyto command ; the folder gets restored into same root folder with prefix RESTORED-Foldername. To verify the file restore from script enter the name of folder restored into the path with prefix RESTORED-foldername.

$Restorepathcheck = "\\server01\D$\BackupTest\RESTORED-Data-Backup-Test"

STEP 3) Open a PowerShell (Administrative PS recommended)
STEP 4) Navigate and set path to script root folder
Example: PS D:\VEEAM-Data-Restore-Test>
STEP 5) Run the script --> PS D:\VEEAM-Data-Restore-Test> .\VB-Restore.ps1

SETP 6) The folder gets restored into it's original location with a prefix "RESTORED-folder name".

Veeam PS module doesn't have the option to restore file/folder into a different location; hence it restore it into the original location by keeping the original copy.
You will get an email notification about the restoration job status.






STEP 7) upon completion of restore operation, the script verifies the file restored and notify if the folder is empty or not. If folder is empty “restore failed”.Also you will get the email notification with details and log.

STEP 8) Logging is enabled on the script for troubleshooting, check “logs” folder under the script root folder if you come across any errors.






STEP 9) The log will be attached and send to the recipient email address with following information

   Restore test performed on Server =  SERVER01

   Restored folder = D:\BackupTest

   Restore path = \\SERVER01\D$\BackupTest\RESTORED-Data-Backup-Test

   Restore start time = 07/23/2019 16:31:22

   Restore complete time = 07/23/2019 16:31:22

   Size of data restored in MB = 5.47 MB

   Please find atached log report of scheduled file restoration test.


   Restore status = Success

STEP 10) Information in the Log file helps to analyze the estimated time requirement for data restore.


STEP 11) The script can be schedule using task scheduler to perform restore tests from backup as per the requirement.

Troubleshooting

1. Logging is enabled on the script with run time, date and year, check the folder "logs"

Future Enhancements


1. Expand functionality for Microsoft Azure backup.

Veeam Backup version Tested

Veeam Backup and Replication 9.5 - Version 9.5.0.1922

Happy Automation ✌

Cheers
Sijo John

Thursday, May 9, 2019

Symantec/VERITAS Scheduled Data Restore Test From Backup


Data is the most valuable asset of any industry and Information technology stores data in digital form with the help of computer hardware’s and software’s.  The computer system can fail and result data loss.

We protect digital data stored in computer hardware’s using backup software, also follow the practice performing test restores of files & folders from the data being backed up.

Doing manual test restore of data is time consuming and again a pain if you have backup solutions from different vendors is being used in your IT infrastructure.

Here we are going to see how to automate the test restore of data from backup using Powershell.

The Script can be used to automate file/folder restore test from the Symantec/VERITAS backup. Restore test is to ensure that the data is recoverable from the backup.

Pre-requisites


1. Windows Powershell version 4.0 or above
2. Ensure that BEMCLI or Backup Exec powershell module installed in your backup server.
To ensure open an administrative powershell and run below commands.
PS C: \windows\system32> Import-Module -name BEMCLI PS C: \windows\system32> Get-command -name BEMCLI
3. Ensure that the user account used to schedule the script must have necessary permissions to restore the files and folders, also should have access to Symantec/VERITAS registry locations.
4. Configure the below on Symantec/VERITAS backup exec console to get an additional alert about job restoration status.
a) Login to BE console --> click on the yellow database icon (for VERITAS – red play icon) on top left side --> Configuration and Settings --> Alerts and notifications --> Email alert and text notification


b) Under Email configuration enter the details of Email Server and Port, Sender name, Sender email address, also enter credentials if your email server requires authentication.























c) Navigate --> click on the yellow database icon (for VERITAS – red play icon) on top left side --> Configuration and Settings --> Alerts and notifications --> Notification recipient --> click add recipient and enter the recipient name and email address --> check the tick box send email notification by email.

d) Click on send test email to verify the alert notification is received to the inbox of configured email recipient.
5. Verify the name of server or servers in the Backup exec console those are selected for restore test.
6.Create a folder named “BackupTest” in the C or D drive of servers chosen for restore test and add some files into it.(Total size of all files in the folder should be greater than 1 MB)
7. By verifying the backup job report ensures that the folder is being backed up in the last backup schedule.
8. Create a folder named “BackupRestoreTest” on the D or any drive of the backup exec server.




How to use the PowerShell Script


STEP 1) Download the script “BE-Restore.ps1” from the GitHub and extract it to any drive.










STEP 2) Edit the following portion in the script.
#Edit this session

#The folder chosen for test restore from the server.

$Foldername = "D:\BackupTest"

#The Server chosen for test restore

$Server = "Server01"

Note: Ensure that server name should be exact match with the name shown in the backup exec console.

Example: “Server01” or Server01.sjohnonline.in

#Data restore path

#Note: If admin shares(d$ c$) are disabled in your machine create a share in the backup server and use the share path "\\backupexecserver\sharename\$today"

#Enabling admin shares may increase the chances of attack surfaces


$Restorepath = "\\backupexecserver\d$\BackupRestoreTest\$today" #Keep $today(variable)

#Recipient name configured in the alert notification on backup exec console.

$recipient = "Sijo John"

#Email address of sender

$FromAddress = "BErestoretest@sjohnonline.in"

#Email address of recipient

$ToAddress = "sjohn@sjohnonline.in"

#Subject of the email

$Subject = "Symantec/VERITAS backup exec Monthly scheduled backup-Restore Test"

#SMTP Server responsible for email service

$SMTPServer = "Enter SMTP server name or IP here"


#SMTP Server port number

$SMTPPort = “Enter the SMTP port number”

STEP 3) Open a PowerShell (Administrative PS recommended)
STEP 4) Navigate and set path to script root folder
Example: PS D:\Symantec-VERITAS-Data-Restore>
STEP 5) Run the script --> PS D:\Symantec-VERITAS-Data-Restore> .\BE-Restore.ps1
SETP 6) Script creates a new folder named “present date” under the restore path specified and restores the files & folders into it. Also you will get an email notification from backup exec console about the restoration job status.
Example: 05-05-2019




STEP 7) upon completion of restore operation, the script verifies the file restored and notify if the folder is empty or not. If folder is empty “restore failed”.
STEP 8) Logging is enabled on the script for troubleshooting, check “logs” folder under the script root folder if you come across any errors.
Example: D:\Symantec-VERITAS-Data-Restore>\logs



STEP 9) The log will be attached and send to the recipient email address with following information
Restore test performed on Server = Server01
Restored folder = D:\BackupTest
Restore path = \backupexecserver\d$\BackupRestoreTest\07052019
Restore start time = 05/07/2019 15:05:36
Restore end time = 05/07/2019 15:05:36
Size of data restored in MB = 9.35 MB
Restore status = Success
STEP 10) Information in the Log file helps to analyze the estimated time requirement for data restore.

STEP 11) The script can be schedule using task scheduler to perform restore tests from backup as per the requirement.

Troubleshooting

1. Logging is enabled on the script with run time, date and year, check the folder "logs"

Future Enhancements

1. Expand functionality for Veeam and Microsoft Azure backup.

Backup Exec version Tested

Support all versions of Symantec/VERITAS Backup-exec
1)Symantec Backup Exec 2014
2)Symantec Backup Exec 2015
3)VERITAS Backup Exec 2016
4)Symantec Backup Exec 2020

Hope this article is helpful saving your time.

Cheers 👍
Sijo John