diff --git a/msp360.psd1 b/msp360.psd1 index d4771d3..399805b 100644 --- a/msp360.psd1 +++ b/msp360.psd1 @@ -6,7 +6,7 @@ CompanyName = 'MSP360' - ModuleVersion = '0.8.8' + ModuleVersion = '0.9.0' # Use the New-Guid command to generate a GUID, and copy/paste into the next line GUID = '69079da4-a0de-426d-bece-ae139c8b5f1a' @@ -49,16 +49,24 @@ # What new features, bug fixes, or deprecated features, are part of this release? ReleaseNotes = @" - New cmdlets: - - None + - Get-MBSPrefix cmdlet (https://kb.msp360.com/managed-backup-service/powershell-module/cmdlets/backup-agent/get-mbsprefix) + - Get-MBSDiskVolume cmdlet (https://kb.msp360.com/managed-backup-service/powershell-module/cmdlets/backup-agent/get-mbsdiskvolume) - Features - - None + - Edit-MBSBackupPlan: Add enable/disable BitLocker option + - Add verbose messages to Get-MBSAgent, Add/Remove-MBSFirewallRules + - Add name of function in beginning of verbose messages - Bug fix: - - Bug: Edit-MBSBackupPlan -Name does not make changes in the backup plan + - Bug: Get-MBSAPIUser - error if a user has no notification emails - Tests: - - None + - Tests: CommonParameterSet New name, account, schedule, Pre/Post actions, retention Edit-MBSBackupPlan.CommonParameterSet New name, account, schedule, Pre/Post actions, retention + - Tests: Add-MBSUserAccount -WindowsAuthD Should not throw + - Tests: Check all tests for Should not throw + - Tests: Edit-MBSUserAccount + - Tests: Get-MBSAgentSetting + - Tests: Update-MBSStorageAccount "@ } } diff --git a/private/Convert-PSObjectToHash.ps1 b/private/Convert-PSObjectToHash.ps1 index 60dedf0..9a9240d 100644 --- a/private/Convert-PSObjectToHash.ps1 +++ b/private/Convert-PSObjectToHash.ps1 @@ -19,7 +19,7 @@ function Convert-PSObjectToHash { $hashtable = @{} foreach( $property in $object.psobject.properties ) { - if ( $property.TypeNameOfValue -eq "System.Object[]"){ + if ( $property.TypeNameOfValue -eq "System.Object[]" -and $null -ne $object."$($property.Name)"){ $hashtable[$property.Name] = $object."$($property.Name)" | ForEach-Object -Begin {$array = @()} -process { if($_.getType().Name -in ("String","Int")){ $array += $_ diff --git a/private/Start-MBSProcess.ps1 b/private/Start-MBSProcess.ps1 index cd13a8b..d93bd3f 100644 --- a/private/Start-MBSProcess.ps1 +++ b/private/Start-MBSProcess.ps1 @@ -69,7 +69,7 @@ function Start-MBSProcess { Default {} } - Write-Verbose -Message "Arguments: $(((((($CMDArguments -replace '-mp "\w*"','-mp "****"') -replace '-p "\w*"','-p "****"') -replace '-cp "\w*"','-cp "****"') -replace '-c "\w*"','-c "****"') -replace '-password "\w*"','-password "****"') -replace '-ep "\w*"','-ep "****"')" + Write-Verbose -Message "$($PSCmdlet.MyInvocation.MyCommand.Name): Arguments: $(((((($CMDArguments -replace '-mp "\w*"','-mp "****"') -replace '-p "\w*"','-p "****"') -replace '-cp "\w*"','-cp "****"') -replace '-c "\w*"','-c "****"') -replace '-password "\w*"','-password "****"') -replace '-ep "\w*"','-ep "****"')" $ProcessStartInfo.Arguments = $CMDArguments $Process = New-Object System.Diagnostics.Process $Process.StartInfo = $ProcessStartInfo diff --git a/public/api/Add-MBSAPIUserBackupDestination.ps1 b/public/api/Add-MBSAPIUserBackupDestination.ps1 index 1a08561..5446b1a 100644 Binary files a/public/api/Add-MBSAPIUserBackupDestination.ps1 and b/public/api/Add-MBSAPIUserBackupDestination.ps1 differ diff --git a/public/api/Edit-MBSAPIAdministrator.ps1 b/public/api/Edit-MBSAPIAdministrator.ps1 index 11db6b6..c1afa26 100644 Binary files a/public/api/Edit-MBSAPIAdministrator.ps1 and b/public/api/Edit-MBSAPIAdministrator.ps1 differ diff --git a/public/api/Edit-MBSAPICompany.ps1 b/public/api/Edit-MBSAPICompany.ps1 index 4729752..764067e 100644 Binary files a/public/api/Edit-MBSAPICompany.ps1 and b/public/api/Edit-MBSAPICompany.ps1 differ diff --git a/public/api/Edit-MBSAPIPackage.ps1 b/public/api/Edit-MBSAPIPackage.ps1 index 05c9adf..cca2592 100644 Binary files a/public/api/Edit-MBSAPIPackage.ps1 and b/public/api/Edit-MBSAPIPackage.ps1 differ diff --git a/public/api/Edit-MBSAPIStorageAccount.ps1 b/public/api/Edit-MBSAPIStorageAccount.ps1 index 56befe0..1951045 100644 Binary files a/public/api/Edit-MBSAPIStorageAccount.ps1 and b/public/api/Edit-MBSAPIStorageAccount.ps1 differ diff --git a/public/api/Edit-MBSAPIUser.ps1 b/public/api/Edit-MBSAPIUser.ps1 index ef53047..ec791ef 100644 Binary files a/public/api/Edit-MBSAPIUser.ps1 and b/public/api/Edit-MBSAPIUser.ps1 differ diff --git a/public/api/Edit-MBSAPIUserBackupDestination.ps1 b/public/api/Edit-MBSAPIUserBackupDestination.ps1 index 873f2ee..3b2baa7 100644 Binary files a/public/api/Edit-MBSAPIUserBackupDestination.ps1 and b/public/api/Edit-MBSAPIUserBackupDestination.ps1 differ diff --git a/public/api/Edit-MBSApiStorageAccountDestination.ps1 b/public/api/Edit-MBSApiStorageAccountDestination.ps1 index 7b6d8d0..89ff840 100644 Binary files a/public/api/Edit-MBSApiStorageAccountDestination.ps1 and b/public/api/Edit-MBSApiStorageAccountDestination.ps1 differ diff --git a/public/api/Get-MBSAPIAdministrator.ps1 b/public/api/Get-MBSAPIAdministrator.ps1 index cbb9831..b822a89 100644 Binary files a/public/api/Get-MBSAPIAdministrator.ps1 and b/public/api/Get-MBSAPIAdministrator.ps1 differ diff --git a/public/api/Get-MBSAPIBilling.ps1 b/public/api/Get-MBSAPIBilling.ps1 index 346b198..ba0f3f8 100644 Binary files a/public/api/Get-MBSAPIBilling.ps1 and b/public/api/Get-MBSAPIBilling.ps1 differ diff --git a/public/api/Get-MBSAPIBuild.ps1 b/public/api/Get-MBSAPIBuild.ps1 index 8fcfb94..7808a16 100644 Binary files a/public/api/Get-MBSAPIBuild.ps1 and b/public/api/Get-MBSAPIBuild.ps1 differ diff --git a/public/api/Get-MBSAPICompany.ps1 b/public/api/Get-MBSAPICompany.ps1 index 6e7725d..b601464 100644 Binary files a/public/api/Get-MBSAPICompany.ps1 and b/public/api/Get-MBSAPICompany.ps1 differ diff --git a/public/api/Get-MBSAPILicense.ps1 b/public/api/Get-MBSAPILicense.ps1 index b620d41..73f4314 100644 Binary files a/public/api/Get-MBSAPILicense.ps1 and b/public/api/Get-MBSAPILicense.ps1 differ diff --git a/public/api/Get-MBSAPIMonitoring.ps1 b/public/api/Get-MBSAPIMonitoring.ps1 index 122252c..f35a378 100644 Binary files a/public/api/Get-MBSAPIMonitoring.ps1 and b/public/api/Get-MBSAPIMonitoring.ps1 differ diff --git a/public/api/Get-MBSAPIPackage.ps1 b/public/api/Get-MBSAPIPackage.ps1 index a5d28de..dd6136b 100644 Binary files a/public/api/Get-MBSAPIPackage.ps1 and b/public/api/Get-MBSAPIPackage.ps1 differ diff --git a/public/api/Get-MBSAPIStorageAccount.ps1 b/public/api/Get-MBSAPIStorageAccount.ps1 index bc5eedd..1476f62 100644 Binary files a/public/api/Get-MBSAPIStorageAccount.ps1 and b/public/api/Get-MBSAPIStorageAccount.ps1 differ diff --git a/public/api/Get-MBSAPIUser.ps1 b/public/api/Get-MBSAPIUser.ps1 index 6cb3e90..64f4652 100644 Binary files a/public/api/Get-MBSAPIUser.ps1 and b/public/api/Get-MBSAPIUser.ps1 differ diff --git a/public/api/Get-MBSAPIUserBackupDestination.ps1 b/public/api/Get-MBSAPIUserBackupDestination.ps1 index 11371e4..5c69751 100644 Binary files a/public/api/Get-MBSAPIUserBackupDestination.ps1 and b/public/api/Get-MBSAPIUserBackupDestination.ps1 differ diff --git a/public/api/Get-MBSAPIUserComputer.ps1 b/public/api/Get-MBSAPIUserComputer.ps1 index 383500c..2dab942 100644 Binary files a/public/api/Get-MBSAPIUserComputer.ps1 and b/public/api/Get-MBSAPIUserComputer.ps1 differ diff --git a/public/api/Get-MBSApiStorageAccountDestination.ps1 b/public/api/Get-MBSApiStorageAccountDestination.ps1 index 3378d1a..ca2479b 100644 Binary files a/public/api/Get-MBSApiStorageAccountDestination.ps1 and b/public/api/Get-MBSApiStorageAccountDestination.ps1 differ diff --git a/public/api/Grant-MBSAPILicense.ps1 b/public/api/Grant-MBSAPILicense.ps1 index b8568dc..1931e81 100644 Binary files a/public/api/Grant-MBSAPILicense.ps1 and b/public/api/Grant-MBSAPILicense.ps1 differ diff --git a/public/api/New-MBSAPIAdministrator.ps1 b/public/api/New-MBSAPIAdministrator.ps1 index a63871b..98b0fb3 100644 Binary files a/public/api/New-MBSAPIAdministrator.ps1 and b/public/api/New-MBSAPIAdministrator.ps1 differ diff --git a/public/api/New-MBSAPICompany.ps1 b/public/api/New-MBSAPICompany.ps1 index 6727c0c..365a873 100644 Binary files a/public/api/New-MBSAPICompany.ps1 and b/public/api/New-MBSAPICompany.ps1 differ diff --git a/public/api/New-MBSAPIPackage.ps1 b/public/api/New-MBSAPIPackage.ps1 index 73c597b..3886f5f 100644 Binary files a/public/api/New-MBSAPIPackage.ps1 and b/public/api/New-MBSAPIPackage.ps1 differ diff --git a/public/api/New-MBSAPIStorageAccount.ps1 b/public/api/New-MBSAPIStorageAccount.ps1 index 0d778ac..9409494 100644 Binary files a/public/api/New-MBSAPIStorageAccount.ps1 and b/public/api/New-MBSAPIStorageAccount.ps1 differ diff --git a/public/api/New-MBSAPIUser.ps1 b/public/api/New-MBSAPIUser.ps1 index 3704ee8..cacc337 100644 Binary files a/public/api/New-MBSAPIUser.ps1 and b/public/api/New-MBSAPIUser.ps1 differ diff --git a/public/api/New-MBSApiStorageAccountDestination.ps1 b/public/api/New-MBSApiStorageAccountDestination.ps1 index 8a9ae9b..6afa0ac 100644 Binary files a/public/api/New-MBSApiStorageAccountDestination.ps1 and b/public/api/New-MBSApiStorageAccountDestination.ps1 differ diff --git a/public/api/Remove-MBSAPIAdministrator.ps1 b/public/api/Remove-MBSAPIAdministrator.ps1 index 7521848..0cff29e 100644 Binary files a/public/api/Remove-MBSAPIAdministrator.ps1 and b/public/api/Remove-MBSAPIAdministrator.ps1 differ diff --git a/public/api/Remove-MBSAPICompany.ps1 b/public/api/Remove-MBSAPICompany.ps1 index eea4269..66e1874 100644 Binary files a/public/api/Remove-MBSAPICompany.ps1 and b/public/api/Remove-MBSAPICompany.ps1 differ diff --git a/public/api/Remove-MBSAPIComputerData.ps1 b/public/api/Remove-MBSAPIComputerData.ps1 index 8dca09f..6463d01 100644 Binary files a/public/api/Remove-MBSAPIComputerData.ps1 and b/public/api/Remove-MBSAPIComputerData.ps1 differ diff --git a/public/api/Remove-MBSAPIPackage.ps1 b/public/api/Remove-MBSAPIPackage.ps1 index 1d76d24..0a6b30a 100644 Binary files a/public/api/Remove-MBSAPIPackage.ps1 and b/public/api/Remove-MBSAPIPackage.ps1 differ diff --git a/public/api/Remove-MBSAPIStorageAccountDestination.ps1 b/public/api/Remove-MBSAPIStorageAccountDestination.ps1 index bea3fda..7da5f3f 100644 Binary files a/public/api/Remove-MBSAPIStorageAccountDestination.ps1 and b/public/api/Remove-MBSAPIStorageAccountDestination.ps1 differ diff --git a/public/api/Remove-MBSAPIUser.ps1 b/public/api/Remove-MBSAPIUser.ps1 index 0f33ea2..b7c516b 100644 Binary files a/public/api/Remove-MBSAPIUser.ps1 and b/public/api/Remove-MBSAPIUser.ps1 differ diff --git a/public/api/Remove-MBSAPIUserBackupDestination.ps1 b/public/api/Remove-MBSAPIUserBackupDestination.ps1 index 99af9ae..8431486 100644 Binary files a/public/api/Remove-MBSAPIUserBackupDestination.ps1 and b/public/api/Remove-MBSAPIUserBackupDestination.ps1 differ diff --git a/public/api/Request-MBSAPIBuild.ps1 b/public/api/Request-MBSAPIBuild.ps1 index c6e8543..7312ed7 100644 Binary files a/public/api/Request-MBSAPIBuild.ps1 and b/public/api/Request-MBSAPIBuild.ps1 differ diff --git a/public/api/Revoke-MBSAPILicense.ps1 b/public/api/Revoke-MBSAPILicense.ps1 index 2554b0b..b61dfd7 100644 Binary files a/public/api/Revoke-MBSAPILicense.ps1 and b/public/api/Revoke-MBSAPILicense.ps1 differ diff --git a/public/cbb/Edit-MBSBackupPlan.ps1 b/public/cbb/Edit-MBSBackupPlan.ps1 index fd729a5..00af1b4 100644 Binary files a/public/cbb/Edit-MBSBackupPlan.ps1 and b/public/cbb/Edit-MBSBackupPlan.ps1 differ diff --git a/public/cbb/Get-MBSAgent.ps1 b/public/cbb/Get-MBSAgent.ps1 index a089c45..1e6abc0 100644 Binary files a/public/cbb/Get-MBSAgent.ps1 and b/public/cbb/Get-MBSAgent.ps1 differ diff --git a/public/cbb/Get-MBSBackupPlan.ps1 b/public/cbb/Get-MBSBackupPlan.ps1 index 8ecc7dc..6886a07 100644 Binary files a/public/cbb/Get-MBSBackupPlan.ps1 and b/public/cbb/Get-MBSBackupPlan.ps1 differ diff --git a/public/cbb/Get-MBSDiskVolume.ps1 b/public/cbb/Get-MBSDiskVolume.ps1 new file mode 100644 index 0000000..2dcbacc --- /dev/null +++ b/public/cbb/Get-MBSDiskVolume.ps1 @@ -0,0 +1,112 @@ +function Get-MBSDiskVolume { + <# + .SYNOPSIS + Lists disk volumes + + .DESCRIPTION + Gets the information about all disks on the current computer. + + .PARAMETER All + List all disk volumes. + + .PARAMETER Supported + List only supported volumes. + + .PARAMETER DiskID + List volumes for the specific disk. + + .PARAMETER SystemRequired + Lists only system required volumes. + + .PARAMETER MasterPassword + Master password. Should be specified if configuration is protected by master password. Use -MasterPassword (ConvertTo-SecureString -string "Your_Password" -AsPlainText -Force) + + .EXAMPLE + PS C:\> Get-MBSDiskVolume -Supported + + Lists all supported volumes. + + .EXAMPLE + PS C:\> Get-MBSDiskVolume + + Lists all disk volumes. + + .EXAMPLE + PS C:\> Get-MBSDiskVolume -SystemRequired + + Lists system required volumes. + + .EXAMPLE + PS C:\> Get-MBSDiskVolume -DiskID 3708e400-2aa4-4991-bdd8-23bf9eec6529 + + Lists volumes for the disk with DiskID "3708e400-2aa4-4991-bdd8-23bf9eec6529". + + .INPUTS + None. + + .OUTPUTS + System.Management.Automation.PSCustomObject + + .NOTES + Author: Ivan Skorin + + .LINK + https://kb.msp360.com/managed-backup-service/powershell-module/cmdlets/backup-agent/get-mbsdiskvolume/ + #> + [CmdletBinding(DefaultParameterSetName='AllVolumes')] + param ( + # Parameter - List all disk volumes + [Parameter(Mandatory=$false, HelpMessage="Lists all volumes", ParameterSetName='AllVolumes')] + [switch] + $All, + # Parameter - List only supported volumes + [Parameter(Mandatory=$true, HelpMessage="Lists only supported volumes", ParameterSetName='SupportedVolumes')] + [switch] + $Supported, + # Parameter - List volumes for the specific disk + [Parameter(Mandatory=$true, HelpMessage="Lists the volumes of the disk with that ID", ParameterSetName='DiskID')] + [Guid] + $DiskID, + # Parameter - Lists only system required volumes + [Parameter(Mandatory=$true, HelpMessage="Lists only system required volumes", ParameterSetName='SystemRequired')] + [switch] + $SystemRequired, + # Parameter - Master password + [Parameter(Mandatory=$false, HelpMessage="Specify Master password. Use -MasterPassword (ConvertTo-SecureString -string ""Your_Password"" -AsPlainText -Force)")] + [SecureString] + $MasterPassword + ) + + begin { + if (-not($CBB = Get-MBSAgent)) { + Break + } + try { + if ((Get-MBSAgentSetting -ErrorAction SilentlyContinue).MasterPassword -ne "" -and $null -ne (Get-MBSAgentSetting -ErrorAction SilentlyContinue).MasterPassword -and -not $MasterPassword) { + $MasterPassword = Read-Host Master Password -AsSecureString + } + } + catch { + + } + } + + process { + $Arguments = " listDiskVolumes" + switch ($PSCmdlet.ParameterSetName) { + 'AllVolumes' { $Arguments += " -a" } + 'SupportedVolumes' { $Arguments += " -s" } + 'DiskID' { $Arguments += " -d $DiskID" } + 'SystemRequired' { $Arguments += " -r" } + Default {} + } + $result = Start-MBSProcess -cmdpath $CBB.CBBCLIPath -cmdarguments $Arguments -output json -MasterPassword $MasterPassword + if ($result.Result -eq "Success") { + $result.Disks + } + } + + end { + + } +} \ No newline at end of file diff --git a/public/cbb/Get-MBSPlanHistory.ps1 b/public/cbb/Get-MBSPlanHistory.ps1 index aab9aff..5080572 100644 Binary files a/public/cbb/Get-MBSPlanHistory.ps1 and b/public/cbb/Get-MBSPlanHistory.ps1 differ diff --git a/public/cbb/New-MBSRecoveryDisk.ps1 b/public/cbb/New-MBSRecoveryDisk.ps1 index f24d728..da9c178 100644 --- a/public/cbb/New-MBSRecoveryDisk.ps1 +++ b/public/cbb/New-MBSRecoveryDisk.ps1 @@ -122,7 +122,7 @@ function New-MBSRecoveryDisk { $Arguments = 'createrecovery' $Arguments += Set-Argument - Write-Verbose -Message $PSCmdlet.ParameterSetName + Write-Verbose -Message "$($PSCmdlet.MyInvocation.MyCommand.Name): $($PSCmdlet.ParameterSetName)" (Start-MBSProcess -CMDPath $CBB.CBBCLIPath -CMDArguments $Arguments -Output short -MasterPassword $MasterPassword).result } diff --git a/public/cbb/Set-MBSAgentSetting.ps1 b/public/cbb/Set-MBSAgentSetting.ps1 index 40ca7a8..683545d 100644 Binary files a/public/cbb/Set-MBSAgentSetting.ps1 and b/public/cbb/Set-MBSAgentSetting.ps1 differ