Skip to content

Commit

Permalink
Release 3.29.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cblandrewa committed Jul 20, 2023
1 parent e385e69 commit 758ba15
Show file tree
Hide file tree
Showing 14 changed files with 135 additions and 45 deletions.
Binary file modified docs/api/get-mbsapibuild.md
Binary file not shown.
Binary file modified docs/backup-agent/edit-mbsbackupplan.md
Binary file not shown.
31 changes: 11 additions & 20 deletions msp360.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# If authoring a script module, the RootModule is the name of your .psm1 file
RootModule = 'msp360.psm1'

Author = 'Andrew Anushin <services@msp360.com>'
Author = 'MSP360 Onboarding Team <services@msp360.com>'

CompanyName = 'MSP360'

ModuleVersion = '3.19.0'
ModuleVersion = '3.29.0'

# Use the New-Guid command to generate a GUID, and copy/paste into the next line
GUID = '69079da4-a0de-426d-bece-ae139c8b5f1a'

Copyright = '(c) 2022 Andrew Anushin. All rights reserved.'
Copyright = '(c) 2023 MSP360. All rights reserved.'

Description = 'The module includes cmdlets to manage MSP360 (CloudBerry) Backup agent, MBS API and tools.'

Expand Down Expand Up @@ -48,25 +48,16 @@

# 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:
- 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
- Edit-MBSNBFBackupPlan: cannot switch to FFI schedule when GFS settings are enabled and vice versa
- Get-MBSBackupPlan: 'Cannot bind argument to parameter 'ReferenceObject' because it is null.' error when parsing full shcedule values in some cases
- New-MBSNBFFileBackupPlan, New-MBSNBFIBBBackupPlan, Edit-MBSNBFBackupPlan: 'Incorrect value for -gfsYMonth. The value '...' must be integer' error if -GFSMonthOfTheYear parameter is specified
- New-MBSNBFFileBackupPlan, New-MBSBackupPlan, Edit-MBSNBFBackupPlan, Edit-MBSBackupPlan: incorrect separators used when parsing array values for -SkipFolder, -IncludeFilesMask, -ExcludeFilesMask parameters
- New-MBSNBFFileBackupPlan: -SkipFolder parameter does not work
- Edit-MBSBackupPlan: cannot combine backup chain parameters with other parameters in one command
- Enhancement:
- 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
- Install-MBSAgent, Install-RMMAgent, Install-CONAgent: URL request and error handling improvements
- Get-MBSAPIBuild: added 'RMMLinuxDEB','RMMLinuxRPM','RMMmacOS' values and renamed 'RMM' to 'RMMWindows' for the -Type parameter
"@
}
}
Expand Down
67 changes: 67 additions & 0 deletions private/Get-FileNameFromURL.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
function Get-FileNameFromURL {
[CmdletBinding()]
param (
[parameter(Mandatory=$true)]
[string]
$URL,
[parameter(Mandatory=$false)]
[switch]
$ParseFromURLifError
)

begin {

}

process {
#[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

$WebRequest = [System.Net.WebRequest]::Create($URL)

# BypassCache level is used by default. If needed, the lines below can be uncommented to set NoCacheNoStore level for the request
#$NoCachePolicy = [System.Net.Cache.RequestCachePolicy]::New([System.Net.Cache.RequestCacheLevel]"NoCacheNoStore")
#$WebRequest.CachePolicy = $NoCachePolicy

$Response = $WebRequest.GetResponse()

if ($Response) {
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name): Content-Type: $($Response.ContentType)"
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name): Content-Length: $($Response.ContentLength)"
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name): IsFromCache: $($Response.IsFromCache)"

$DispositionHeader = $Response.Headers['Content-Disposition']
if ($DispositionHeader) {
$Disposition = [System.Net.Mime.ContentDisposition]::new($DispositionHeader)
#
$FileName = $Disposition.FileName
} elseif ($ParseFromURLifError) {
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name): The response didn't return Content-Disposition header. Parsing file name from URL"
if (($Response.ContentType -eq "application/octet-stream") -Or ($Response.ContentType -eq "application/x-msi")) {
$ResponseUri = $Response.ResponseUri.ToString()
$FileNameParseFromURL = $ResponseUri.Substring($ResponseUri.LastIndexOf('/')+1)
$VerboseMessageAdd = " (parsed from URL)"
#
$FileName = $FileNameParseFromURL
} else {
Write-Error "ERROR: The file from the response URL is not of type ""application/octet-stream"" or ""application/x-msi""."
}
} else {
Write-Error "ERROR: The response to the provided URL does not include information about downloadable content."
}

$Response.Dispose()

if ($FileName) {
Write-Verbose "$($PSCmdlet.MyInvocation.MyCommand.Name): FileName$($VerboseMessageAdd): $($FileName)"
return $FileName
} else {
return $false
}
}
}

end {

}
}
8 changes: 4 additions & 4 deletions private/New-MBSNBFBackupPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function New-MBSNBFBackupPlan {
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.GFSMonthOfTheYear -gt 0){$Argument += " -gfsYMonth $(($Object.BackupPlanCommonOption.GFSMonthOfTheYear).value__)"}

if($Object.BackupPlanCommonOption.ForeverForwardIncremental){
if ($CBBVersion -ge [version]"7.8.0"){
Expand Down Expand Up @@ -238,9 +238,9 @@ function New-MBSNBFBackupPlan {
}else{
$Argument += " -es no"
}
if ($Object.SkipFolders){$Argument += " -skipf $($Object.SkipFolders -join ',')"}
if ($Object.IncludeFilesMask){$Argument += " -ifm $($Object.IncludeFilesMask -join ',')"}
if ($Object.ExcludeFilesMask){$Argument += " -efm $($Object.ExcludeFilesMask -join ',')"}
if ($Object.SkipFolder){$Argument += " -skipf $($Object.SkipFolder -join ';' -replace ',',';')"}
if ($Object.IncludeFilesMask){$Argument += " -ifm $($Object.IncludeFilesMask -join ';' -replace ',',';')"}
if ($Object.ExcludeFilesMask){$Argument += " -efm $($Object.ExcludeFilesMask -join ';' -replace ',',';')"}
if ($Object.IgnoreErrorPathNotFound) {$Argument += " -iepnf yes"}
if ($Object.BackupItem){
$Object.BackupItem | ForEach-Object -Process {
Expand Down
Binary file modified public/api/Get-MBSAPIBuild.ps1
Binary file not shown.
Binary file modified public/cbb/Edit-MBSBackupPlan.ps1
Binary file not shown.
46 changes: 38 additions & 8 deletions public/cbb/Edit-MBSNBFBackupPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ function Edit-MBSNBFBackupPlan {
}
}

if ((($null -ne $ForeverForwardIncremental) -Or ($null -ne $IntelligentRetention)) -And (($null -ne $GFSKeepWeekly) -Or ($null -ne $GFSKeepMonthly) -Or ($null -ne $GFSKeepYearly) -Or ($null -ne $GFSMonthOfTheYear))) {
if ((($ForeverForwardIncremental -eq $True) -Or ($IntelligentRetention -eq $True)) -And (($GFSKeepWeekly -gt 0) -Or ($GFSKeepMonthly -gt 0) -Or ($GFSKeepYearly -gt 0) -Or ($($GFSMonthOfTheYear.value__) -gt 0))) {
Write-Error "Forever Forward Incremental and GFS settings cannot be used at the same time"
Break
}
Expand Down Expand Up @@ -791,25 +791,39 @@ function Edit-MBSNBFBackupPlan {
Write-Warning "Forever Forward Incremental cannot be enabled for file system storage destinations. Ignoring ForeverForwardIncremental option"
} else {
if ($RecurringType -And $At) {
$ForeverForwardIncrementalIsSet = $False
if ($Null -ne $KeepVersionPeriod) {
$Argument += " -ffi yes"
$ForeverForwardIncrementalIsSet = $True
} elseif ($BackupPlan.SerializationSupportRetentionTime -ne "10675199.02:48:05.4775807") {
$KeepVersionPeriodFromPlan = ([timespan]$BackupPlan.SerializationSupportRetentionTime).TotalDays
Write-Warning """KeepKeepVersionPeriod"" parameter not specified while enabling Forever Forward Incremental. Existing renetion policy setting (keep backup for $KeepVersionPeriodFromPlan days) will be used"
if ($KeepVersionPeriodFromPlan -eq 0) {
$KeepVersionPeriodFromPlan = 30
Write-Warning """KeepKeepVersionPeriod"" parameter not specified and existing retention policy is set to disabled while enabling Forever Forward Incremental. Retention setting to keep $KeepVersionPeriodFromPlan days will be used"
} else {
Write-Warning """KeepKeepVersionPeriod"" parameter not specified while enabling Forever Forward Incremental. Existing renetion policy setting (keep backup for $KeepVersionPeriodFromPlan days) will be used"
}
$Argument += " -ffi yes -purge $($KeepVersionPeriodFromPlan)d"
$ForeverForwardIncrementalIsSet = $True
} else {
Write-Warning """KeepKeepVersionPeriod"" parameter not specified and no retention policy specified in the current plan while enabling Forever Forward Incremental. Ignoring ForeverForwardIncremental option"
}
if (($ForeverForwardIncrementalIsSet) -And ($BackupPlan.GFSPolicySettings.IsEnabled)) {
Write-Warning "GFS settings are enabled in the current plan while enabling Forever Forward Incremental. Disabling GFS settings"
if (($GFSKeepWeekly -ne 0) -And ($BackupPlan.GFSPolicySettings.Weekly.IsEnabled)) {$Argument += " -gfsWDisable"}
if (($GFSKeepMonthly -ne 0) -And ($BackupPlan.GFSPolicySettings.Monthly.IsEnabled)) {$Argument += " -gfsMDisable"}
if (($GFSKeepYearly -ne 0) -And ($BackupPlan.GFSPolicySettings.Yearly.IsEnabled)) {$Argument += " -gfsYDisable"}
}
} else {
Write-Warning "Schedule settings not specified while enabling Forever Forward Incremental. Ignoring ForeverForwardIncremental option"
}
}
} else {
$Argument += " -ffi no"
if ($BackupPlan.Schedule.Enabled) {
if (($BackupPlan.Schedule.Enabled) -And (-Not ($RecurringType -And $At))) {
Write-Warning "The schedule settings will be set to ""No schedule"" while disabling Forever Forward Incremental"
}
if ($BackupPlan.ForceFullSchedule.Enabled) {
if (($BackupPlan.ForceFullSchedule.Enabled) -And (-Not ($RecurringTypeForceFull))) {
if (-Not ($DisableForceFullSchedule)){$Argument += " -sdForce"}
}
}
Expand Down Expand Up @@ -841,6 +855,22 @@ function Edit-MBSNBFBackupPlan {
$Argument += " -purge no"
}
}

if ((($GFSKeepWeekly -gt 0) -Or ($GFSKeepMonthly -gt 0) -Or ($GFSKeepYearly -gt 0) -Or ($($GFSMonthOfTheYear.value__) -gt 0)) -And ($ForeverForwardIncremental -ne $false) -And ($BackupPlan.ForwardIncremental)){
Write-Warning "Forever Forward Incremental settings are enabled in the current plan while enabling GFS. Disabling Forever Forward Incremental option"
$Argument += " -ffi no"
if (($BackupPlan.Schedule.Enabled) -And (-Not ($RecurringType -And $At))) {
Write-Warning "The schedule settings will be set to ""No schedule"" while disabling Forever Forward Incremental"
}
if (($BackupPlan.ForceFullSchedule.Enabled) -And (-Not ($RecurringTypeForceFull))) {
if (-Not ($DisableForceFullSchedule)){$Argument += " -sdForce"}
}
if (($BackupPlan.SerializationSupportRetentionTime -ne "10675199.02:48:05.4775807") -And ($null -eq $KeepVersionPeriod)) {
$KeepVersionPeriodFromPlan = ([timespan]$BackupPlan.SerializationSupportRetentionTime).TotalDays
Write-Warning """KeepKeepVersionPeriod"" parameter not specified while switching from Forever Forward Incremental to GFS. Existing renetion policy setting (keep backup for $KeepVersionPeriodFromPlan days) will be used"
$Argument += " -purge $($KeepVersionPeriodFromPlan)d"
}
}

if($Null -ne $GFSKeepWeekly){
if($GFSKeepWeekly -gt 0){
Expand All @@ -863,7 +893,7 @@ function Edit-MBSNBFBackupPlan {
$Argument += " -gfsYDisable"
}
}
if($GFSMonthOfTheYear -gt 0){$Argument += " -gfsYMonth $($GFSMonthOfTheYear)"}
if($GFSMonthOfTheYear -gt 0){$Argument += " -gfsYMonth $($GFSMonthOfTheYear.value__)"}

#
if ($RecurringType){
Expand Down Expand Up @@ -1118,9 +1148,9 @@ function Edit-MBSNBFBackupPlan {
$Argument += " -es no"
}
}
if ($SkipFolders){$Argument += " -skipf "+'"{0}"' -f ($SkipFolders -join ';')}
if ($IncludeFilesMask){$Argument += " -ifm "+'"{0}"' -f ($IncludeFilesMask -join ';')}
if ($ExcludeFilesMask){$Argument += " -efm "+'"{0}"' -f ($ExcludeFilesMask -join ';')}
if ($SkipFolders){$Argument += " -skipf "+'"{0}"' -f ($SkipFolders -join ';' -replace ',',';')}
if ($IncludeFilesMask){$Argument += " -ifm "+'"{0}"' -f ($IncludeFilesMask -join ';' -replace ',',';')}
if ($ExcludeFilesMask){$Argument += " -efm "+'"{0}"' -f ($ExcludeFilesMask -join ';' -replace ',',';')}
if ($null -ne $IgnoreErrorPathNotFound){
if ($IgnoreErrorPathNotFound) {
$Argument += " -iepnf yes"
Expand Down
Binary file modified public/cbb/Get-MBSAgent.ps1
Binary file not shown.
Binary file modified public/cbb/Get-MBSBackupPlan.ps1
Binary file not shown.
Binary file modified public/cbb/Install-MBSAgent.ps1
Binary file not shown.
6 changes: 3 additions & 3 deletions public/cbb/New-MBSBackupPlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,9 @@ function New-MBSBackupPlan {
}else{
$Argument += " -es no"
}
if ($SkipFolder){$Argument += " -skipf ""$($SkipFolder -join ',')"""}
if ($IncludeFilesMask){$Argument += " -ifm $($IncludeFilesMask -join ',')"}
if ($ExcludeFilesMask){$Argument += " -efm $($ExcludeFilesMask -join ',')"}
if ($SkipFolder){$Argument += " -skipf ""$($SkipFolder -join ';' -replace ',',';')"""}
if ($IncludeFilesMask){$Argument += " -ifm $($IncludeFilesMask -join ';' -replace ',',';')"}
if ($ExcludeFilesMask){$Argument += " -efm $($ExcludeFilesMask -join ';' -replace ',',';')"}
if ($IgnoreErrorPathNotFound) {$Argument += " -iepnf yes"}
if ($TrackDeletedFiles) {$Argument += " -trackdeleted yes"}
if ($BackupFile){$Argument += " -f "+'"{0}"' -f ($BackupFile -join '" -f "')}
Expand Down
22 changes: 12 additions & 10 deletions public/connect/Install-CONAgent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,21 @@ function Install-CONAgent {
$Arguments = "/S /t=$ConfigurationID"
}
'ByURL' {
$ID = $URL.Substring($URL.LastIndexOf("/")+1)
$FileName = "ConnectSetup_t$ID.exe"
#$ID = $URL.Substring($URL.LastIndexOf("/")+1)
#$FileName = "ConnectSetup_t$ID.exe"
$FileName = Get-FileNameFromURL -URL $URL -ParseFromURLifError
$Arguments = "/S"
}
}

if (($Force) -Or (-Not(Get-CONAgent -ErrorAction SilentlyContinue))) {
$Folder = New-Item -Path "$TempPath" -Name "$TempFolder" -ItemType "directory" -ErrorAction SilentlyContinue
(New-Object Net.WebClient).DownloadFile("$URL", "$TempPath\$TempFolder\$FileName")
(Start-MBSProcess -CMDPath "$TempPath\$TempFolder\$FileName" -CMDArguments "$Arguments").stdout
Remove-Item -Path "$TempPath\$TempFolder" -Force -Recurse
}else{
return "The Connect agent is already installed."
if ($FileName) {
if (($Force) -Or (-Not(Get-CONAgent -ErrorAction SilentlyContinue))) {
$Folder = New-Item -Path "$TempPath" -Name "$TempFolder" -ItemType "directory" -ErrorAction SilentlyContinue
(New-Object Net.WebClient).DownloadFile("$URL", "$TempPath\$TempFolder\$FileName")
(Start-MBSProcess -CMDPath "$TempPath\$TempFolder\$FileName" -CMDArguments "$Arguments").stdout
Remove-Item -Path "$TempPath\$TempFolder" -Force -Recurse
}else{
return "The Connect agent is already installed."
}
}
}

Expand Down
Binary file modified public/rmm/Install-RMMAgent.ps1
Binary file not shown.

0 comments on commit 758ba15

Please sign in to comment.