how to full backup of Virtual Machine using MARS agent with PowerShell ?

Dnyaneshwar Surywanshi 156 Reputation points
2021-03-02T06:39:51.937+00:00

I want to backup my Virtual Machine using MARS agent. Below is my script for configuring backup schedule but I want full backup not drive folder level.

$BackupPolicy = New-OBPolicy

Create backup schedule (modify variables as required)

$DaysOfTheWeek = "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
$TimesOfDay = "23:30"
$BackupSchedule = New-OBSchedule -DaysOfWeek $DaysOfTheWeek -TimesOfDay $TimesOfDay

Associate schedule with the blank policy you created above

Set-OBSchedule -Policy $BackupPolicy -Schedule $BackupSchedule

Configure Backup Retention and associate with our policy (modify variables as required)

$RetentionDays = "30"
$BackupRetentionPolicy = New-OBRetentionPolicy -RetentionDays $RetentionDays
Set-OBRetentionPolicy -Policy $BackupPolicy -RetentionPolicy $BackupRetentionPolicy

Configure file and folder inclusion/exclusion policy (modify variables as required for your client machine/server)

$Inclusions = New-OBFileSpec -FileSpec @("C:\", "D:\")
$Exclusions = New-OBFileSpec -FileSpec @("C:\windows", "C:\temp") -Exclude
Add-OBFileSpec -Policy $BackupPolicy -FileSpec $Inclusions

Commit new policy for use by Azure Backup

Set-OBPolicy -Policy $BackupPolicy -Confirm:$false

Azure Backup
Azure Backup
An Azure backup service that provides built-in management at scale.
1,490 questions
{count} votes

1 answer

Sort by: Most helpful
  1. SadiqhAhmed-MSFT 49,326 Reputation points Microsoft Employee Moderator
    2021-03-03T16:55:39.807+00:00

    @Dnyaneshwar Surywanshi Full Azure VM backup is better achieved using Azure VM backup rather than via MARS.

    The closest option is to use system state backups along with File and folder backups. System state restore is a 2-stage process where MARS will pull down the backed up copy of the system state backup following which the user will need to use Windows Server Backup to restore the system state. The complexity on an Azure VM is that when the system boots into safe mode to restore the system state, RDP access is lost. Additionally if there were to be a problem with the System State restore, a Windows Recovery Environment may not be an option.

    An alternative may be that you can choose to back up only the OS disk of the VM and use MARS for the rest of the data.

    ----------------------------------------------------------------------------------------------------------------------

    If the response helped, do "Accept Answer" and up-vote it


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.