Skip to content

Commit

Permalink
Release 3.19.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cblandrewa committed May 10, 2023
1 parent 88aece8 commit e385e69
Show file tree
Hide file tree
Showing 18 changed files with 1,729 additions and 54 deletions.
Binary file added docs/backup-agent/convert-mbsbackupplantonbf.md
Binary file not shown.
Binary file modified docs/backup-agent/edit-mbsbackupplan.md
Binary file not shown.
Binary file added docs/backup-agent/edit-mbsnbfbackupplan.md
Binary file not shown.
Binary file modified docs/backup-agent/new-mbsbackupplan.md
Binary file not shown.
Binary file modified docs/backup-agent/new-mbsbackupplancommonoption.md
Binary file not shown.
Binary file modified docs/backup-agent/new-mbsnbfbackupplancommonoption.md
Binary file not shown.
Binary file modified docs/backup-agent/new-mbsnbffilebackupplan.md
Binary file not shown.
32 changes: 18 additions & 14 deletions msp360.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

CompanyName = 'MSP360'

ModuleVersion = '2.53.0'
ModuleVersion = '3.19.0'

# Use the New-Guid command to generate a GUID, and copy/paste into the next line
GUID = '69079da4-a0de-426d-bece-ae139c8b5f1a'
Expand Down Expand Up @@ -48,21 +48,25 @@

# What new features, bug fixes, or deprecated features, are part of this release?
ReleaseNotes = @"
- New cmdlets:
- Edit-MBSNBFBackupPlan (https://mspbackups.com/AP/Help/powershell/cmdlets/backup-agent/edit-mbsnbfbackupplan)
- Convert-MBSBackupPlanToNBF (https://mspbackups.com/AP/Help/powershell/cmdlets/backup-agent/convert-mbsbackupplantonbf)
- Bugfix:
- Get-MBSBackupPlan: NBF plans - incorrect frequency is set if 'DayOfWeek' includes all days and the initial frequency is not 'Weekly'
- Get-MBSBackupPlan: NBF plans - 'DayOfWeek' for monthly incremental schedule is not set
- Get-MBSBackupPlan: NBF plans - 'DayOfMonth' value is not set if frequency is 'DayOfMonth'
- Get-MBSBackupPlan: NBF plans - 'RepeatInterval' and 'RepeatStartDate' are not set
- New-MBSNBFFileBackupPlan: -KeepVersionPeriod parameter does not work if backup agent version is from 7.8.0 to 7.8.2
- New-MBSBackupPlan: schedule set incorrectly when incremental and full schedules are specified
- Edit-MBSBackupPlan: all backup chain parameters should be specified even if only one parameter change is needed
- Edit-MBSBackupPlan: backup chain is disabled if next backup plan ID in chain not specified in command for backup agent version 7.2.1 and higher
- Enhancement:
- Get-MBSBackupPlan: RAW output type now returns NBF backup plans in their source (not converted) format in the same form as CBF backup plans
- Edit-MBSBackupPlan: adding and disabling file/folder exclusions for Image-Based backup plans improvements (MBS Backup Agent release 7.8.2)
- Stop-MBSPlan: force stop improvements (MBS Backup Agent release 7.8.2)
- Get-MBSAgentSetting, Get-MBSStorageAccount: added checks for cases when 'enginesettings.list' is empty, corrupt or incorrect format
- Get-MBSAPIBuild: added RMM build type
- Get-MBSAPIBuild: renamed build type values for convenience. Possible values - 'Windows','VMEdition','LinuxDEB','LinuxRPM','macOS','RMM'
- Request-MBSAPIBuild: introduced enums for -BuildType and -BuildEditions parameters
- Remove-MBSAgent, Remove-CONAgent, Remove-RMMAgent: output message improvements
- Set-MSP360ModuleSettings: added -SkipEngineSettingsListCheck parameter for cases when some cmdlets do not work properly if 'enginesettings.list' is not present (e.g. after MBS Backup Agent clean install, before assigning a backup user)
- New-MBSNBFBackupPlanCommonOption, Get-MBSBackupPlan: added support for -ForeverForwardIncremental and -IntelligentRetention parameters
- New-MBSNBFBackupPlanCommonOption: changed value type of parameter -KeepVersionPeriod from Timespan to Integer
- New-MBSBackupPlanCommonOption: changed value type of parameters -KeepVersionPeriod and -DelayPurgePeriod from Timespan to Integer
- New-MBSBackupPlanCommonOption, New-MBSNBFBackupPlanCommonOption: added backup chain parameters
- New-MBSNBFFileBackupPlan: added -KeepEFSEncryption parameter to back up EFS files as encrypted (MBS Backup Agent release 7.6.0)
- Edit-MBSBackupPlan: changed names for backup chain parameters (check help: https://mspbackups.com/AP/Help/powershell/cmdlets/backup-agent/edit-mbsbackupplan)
- Edit-MBSBackupPlan: added -SyntheticFull parameter for Image-Based backup plans
- Edit-MBSBackupPlan: added GlacierInstantRetrieval AWS S3 storage class support
- Edit-MBSBackupPlan: code optimization and minor bugfixes
- Updated help for Edit-MBSBackupPlan
"@
}
}
Expand Down
15 changes: 12 additions & 3 deletions private/Add-MBSCBBType.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ namespace MBS.Agent.Plan
public Nullable<bool> PreActionContinueAnyway;
public string PostActionCommand;
public Nullable<bool> PostActionRunAnyway;
public string BackupChainPlanID;
public Nullable<bool> BackupChainExecuteOnlyAfterSuccess;
public Nullable<bool> BackupChainExecuteForceFull;
public MBS.Agent.Plan.Notification ResultEmailNotification;
public MBS.Agent.Plan.Notification AddEventToWindowsLog;
public Nullable<TimeSpan> KeepVersionPeriod;
public Nullable<int> KeepVersionPeriod;
public Nullable<int> KeepNumberOfVersion;
public bool KeepLastVersion;
public Nullable<TimeSpan> DelayPurgePeriod;
public Nullable<int> DelayPurgePeriod;
}
public class NBFBackupPlanCommonOption {
Expand All @@ -59,13 +62,18 @@ namespace MBS.Agent.Plan
public Nullable<bool> PreActionContinueAnyway;
public string PostActionCommand;
public Nullable<bool> PostActionRunAnyway;
public string BackupChainPlanID;
public Nullable<bool> BackupChainExecuteOnlyAfterSuccess;
public Nullable<bool> BackupChainExecuteForceFull;
public MBS.Agent.Plan.Notification ResultEmailNotification;
public MBS.Agent.Plan.Notification AddEventToWindowsLog;
public Nullable<TimeSpan> KeepVersionPeriod;
public int KeepVersionPeriod;
public int GFSKeepWeekly;
public int GFSKeepMonthly;
public int GFSKeepYearly;
public MBS.Agent.Plan.Month GFSMonthOfTheYear;
public bool ForeverForwardIncremental;
public bool IntelligentRetention;
}
public class FileLevelBackupPlan : BackupPlan{
Expand Down Expand Up @@ -95,6 +103,7 @@ namespace MBS.Agent.Plan
public bool BackupNTFSPermissions;
public bool FastNTFSScan;
public bool ForceUsingVSS;
public bool KeepEFSEncryption;
public bool UseShareReadWriteModeOnError;
public bool BackupEmptyFolders;
public string BackupOnlyAfter;
Expand Down
75 changes: 69 additions & 6 deletions private/New-MBSNBFBackupPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,62 @@ function New-MBSNBFBackupPlan {
$Argument += " -paa no"
}
}
if ($Object.BackupPlanCommonOption.BackupChainPlanID) {
if ($CBBVersion -ge [version]"7.2.1.0") {
$Argument += " -chainPlanOn $($Object.BackupPlanCommonOption.BackupChainPlanID)"
if ($null -ne $Object.BackupPlanCommonOption.BackupChainExecuteOnlyAfterSuccess) {
if ($Object.BackupPlanCommonOption.BackupChainExecuteOnlyAfterSuccess) {
$Argument += " -chainPlanAfterSuccess yes"
}else{
$Argument += " -chainPlanAfterSuccess no"
}
}
if ($null -ne $Object.BackupPlanCommonOption.BackupChainExecuteForceFull) {
if ($Object.BackupPlanCommonOption.BackupChainExecuteForceFull) {
$Argument += " -chainPlanForceFull yes"
}else{
$Argument += " -chainPlanForceFull no"
}
}
}else{
Write-Warning "Backup agent version is $CBBVersion. Backup chain parameters require version 7.2.1 or higher. Ignoring backup chain options"
}
}

if($Null -ne $Object.BackupPlanCommonOption.ResultEmailNotification){$Argument += " -notification $($Object.BackupPlanCommonOption.ResultEmailNotification)"}
if($Null -ne $Object.BackupPlanCommonOption.AddEventToWindowsLog){$Argument += " -winLog $($Object.BackupPlanCommonOption.AddEventToWindowsLog)"}
if($Null -ne $Object.BackupPlanCommonOption.KeepVersionPeriod){
if($Object.BackupPlanCommonOption.KeepVersionPeriod.TotalDays -gt 0){
$Argument += " -purge $([Math]::Round($Object.BackupPlanCommonOption.KeepVersionPeriod.TotalDays))d"
}else{

if($Object.BackupPlanCommonOption.KeepVersionPeriod -gt 0){
$Argument += " -purge $($Object.BackupPlanCommonOption.KeepVersionPeriod)d"
}else{
if (-Not ($Object.BackupPlanCommonOption.ForeverForwardIncremental)) {
$Argument += " -purge no"
} else {
Write-Warning """KeepVersionPeriod"" parameter is set to 0 while enabling Forever Forward Incremental. Setting ""KeepVersionPeriod"" value to 30 days (default)"
$Argument += " -purge 30d"
}
}

if($Object.BackupPlanCommonOption.GFSKeepWeekly -gt 0){$Argument += " -gfsW $($Object.BackupPlanCommonOption.GFSKeepWeekly)"}
if($Object.BackupPlanCommonOption.GFSKeepMonthly -gt 0){$Argument += " -gfsM $($Object.BackupPlanCommonOption.GFSKeepMonthly)"}
if($Object.BackupPlanCommonOption.GFSKeepYearly -gt 0){$Argument += " -gfsY $($Object.BackupPlanCommonOption.GFSKeepYearly)"}
if($Object.BackupPlanCommonOption.GFSMonthOfTheYear -gt 0){$Argument += " -gfsYMonth $($Object.BackupPlanCommonOption.GFSMonthOfTheYear)"}

if($Object.BackupPlanCommonOption.ForeverForwardIncremental){
if ($CBBVersion -ge [version]"7.8.0"){
if ($Object.Schedule){
$Argument += " -ffi yes"
if($Object.BackupPlanCommonOption.IntelligentRetention){
$Argument += " -ir yes"
}else{
$Argument += " -ir no"
}
}else{
Write-Warning "Schedule settings not specified while enabling Forever Forward Incremental. Ignoring ForeverForwardIncremental option"
}
}else{
Write-Warning "Backup agent version is $CBBVersion. ""ForeverForwardIncremental"" parameter requires version 7.8.0 or higher. Ignoring ForeverForwardIncremental option"
}
}

switch ($PSCmdlet.ParameterSetName){
'FileLevel' {
Expand All @@ -182,6 +223,13 @@ function New-MBSNBFBackupPlan {
} else {
Write-Warning "MSP360ModuleSettings.SkipVSS is set. Ignoring ForceUsingVSS option"
}
if ($Object.KeepEFSEncryption) {
if ($CBBVersion -ge [version]"7.6.0.70") {
$Argument += " -keepEfsEncryption yes"
}else{
Write-Warning "Backup agent version is $CBBVersion. ""KeepEFSEncryption"" parameter requires version 7.6.0 or higher. Ignoring KeepEFSEncryption option"
}
}
if ($Object.UseShareReadWriteModeOnError) {$Argument += " -sharerw yes"}
if ($Object.BackupEmptyFolders) {$Argument += " -bef yes"}
if ($Object.BackupOnlyAfter){$Argument += " -oa $($Object.BackupOnlyAfter.ToString('MM/dd/yyyy HH:mm tt'))"}
Expand Down Expand Up @@ -324,8 +372,23 @@ function New-MBSNBFBackupPlan {


$BPID = (Start-MBSProcess -CMDPath $CBB.CBBCLIPath -CMDArguments $Arguments -Output json -MasterPassword $MasterPassword -ErrorAction Stop).ID
if (($Null -ne $NBFFileLevelBackupPlan.BackupPlanCommonOption.KeepVersionPeriod) -And (($CBBVersion -ge [version]"7.8.0") -And ($CBBVersion -lt [version]"7.8.3"))) {
$ArgumentKeepVersionPeriod = " editBackupPlan -id $BPID"
if($NBFFileLevelBackupPlan.BackupPlanCommonOption.KeepVersionPeriod -gt 0){
$ArgumentKeepVersionPeriod += " -purge $($NBFFileLevelBackupPlan.BackupPlanCommonOption.KeepVersionPeriod)d"
}else{
if (-Not ($NBFFileLevelBackupPlan.BackupPlanCommonOption.ForeverForwardIncremental)) {
$ArgumentKeepVersionPeriod += " -purge no"
} else {
$ArgumentKeepVersionPeriod = ""
}
}
if ($ArgumentKeepVersionPeriod) {
Start-MBSProcess -CMDPath $CBB.CBBCLIPath -CMDArguments $ArgumentKeepVersionPeriod -Output json -MasterPassword $MasterPassword -ErrorAction Stop
}
}
if ($NBFFileLevelBackupPlan.ExcludeItem -and ($CBBVersion -lt [version]"7.5.0")) {
$ArgumentsExcludeItem = " editBackupPlan -nbf -id $BPID"
$ArgumentsExcludeItem = " editBackupPlan -id $BPID"
$NBFFileLevelBackupPlan.ExcludeItem | ForEach-Object -Process {
if (Test-Path -Path $_ -PathType Container) {
$ArgumentsExcludeItem += " -rd ""$_"""
Expand Down
133 changes: 133 additions & 0 deletions public/cbb/Convert-MBSBackupPlanToNBF.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
function Convert-MBSBackupPlanToNBF {
<#
.SYNOPSIS
Converts the Legacy plan to the New Backup Format (NBF).
.DESCRIPTION
Converts the Legacy backup format plan to the New Backup Format (NBF). The minimum supported version of the MBS backup agent is 7.8.3.
.PARAMETER Name
Specify Plan Name.
.PARAMETER ID
Specify Plan ID.
.PARAMETER Force
Convert forcefully, ignoring warnings.
.PARAMETER MasterPassword
Master password. Should be specified if configuration is protected by master password. Use -MasterPassword (ConvertTo-SecureString -string "Your_Password" -AsPlainText -Force)
.PARAMETER PurgeLegacy
Allows to enable/disable purging of legacy data for converted plan. Possible values: $true/$false
.EXAMPLE
Get-MBSBackupPlan -StorageType All -PlanFormat CBF -PlanType File-Level | Convert-MBSBackupPlanToNBF -PurgeLegacy
Convert all Legacy file backup plans to New Backup Format.
.EXAMPLE
Convert-MBSBackupPlanToNBF -Name test -Whatif
Test conversion to New Backup Format of a backup plan named "test". If the command outputs warnings, the convertion should be performed with the -Force switch to ignore them.
.NOTES
Author: MSP360 Onboarding Team
.LINK
https://mspbackups.com/AP/Help/powershell/cmdlets/backup-agent/convert-mbsbackupplantonbf
#>

[CmdletBinding()]
param (
#
[Parameter(ValueFromPipelineByPropertyName, HelpMessage='Plan ID')]
[string]
$ID,
#
[Parameter(ValueFromPipelineByPropertyName, HelpMessage='Plan name')]
[string]
$Name,
#
[Parameter(Mandatory=$False, HelpMessage='Master password. Should be specified if configuration is protected by master password. Use -MasterPassword (ConvertTo-SecureString -string ""Your_Password"" -AsPlainText -Force)')]
[SecureString]
$MasterPassword,
#
[Parameter(Mandatory=$False, HelpMessage='Allows to enable/disable purging of legacy data for converted plan. Possible values: $true/$false')]
[boolean]
$PurgeLegacy=$true,
#
[Parameter(Mandatory=$False, HelpMessage='Test conversion, no changes will be made')]
[switch]
$Whatif,
#
[Parameter(Mandatory=$False, HelpMessage='Perform conversion forcibly, ignore any warnings')]
[switch]
$Force,
#
[Parameter(Mandatory=$False, HelpMessage='Returns an object representing the resulting plan object. By default, this cmdlet does not generate any output.')]
[switch]
$PassThru
)

begin {
if (-not($CBB = Get-MBSAgent)) {
Break
}
if ([System.version](Get-MBSAgent).version -lt [System.version]"7.8.3.0") {
Write-Error "Version $($CBB.version) is not supported. Please upgrade to the minimum supported version 7.8.3"
Break
}
if (-Not(Test-MBSAgentMasterPassword)) {
$MasterPassword = $null
} else {
if (-Not(Test-MBSAgentMasterPassword -CheckMasterPassword -MasterPassword $MasterPassword)) {
$MasterPassword = Read-Host -AsSecureString -Prompt "Master Password"
if (-Not(Test-MBSAgentMasterPassword -CheckMasterPassword -MasterPassword $MasterPassword)) {
Write-Error "ERROR: Master password is not specified"
Break
}
}
}
}

process {

function Set-Argument{
if ($ID){
$Argument += " -id $ID"
}else{
$Argument += " -n ""$Name"""
}
if ($Whatif){
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name): -WhatIf parameter specified. Plan will not be converted"
$Argument += " -whatif"
}else{
if ($PurgeLegacy){
$Argument += " -purgelegacy yes"
}else{
$Argument += " -purgelegacy no"
}
}
if($Force){
$Argument += " -force"
}
Return $Argument
}

$Arguments = " convertToNBF"
$Arguments += Set-Argument

$result = Start-MBSProcess -CMDPath $CBB.CBBCLIPath -CMDArguments $Arguments -Output json -MasterPassword $MasterPassword

if (($PassThru) -And (-Not ($Whatif))) {
$PlanResult = (Get-MBSBackupPlan -PlanFormat NBF | Where-Object {$_.ID -eq $ID})
return $PlanResult
}
}

end {

}
}
Binary file modified public/cbb/Edit-MBSBackupPlan.ps1
Binary file not shown.
Loading

0 comments on commit e385e69

Please sign in to comment.