Merge pull request #453 from MallocArray/master
Resolve issues with Backup-VCSA
This commit is contained in:
@@ -35,11 +35,11 @@ Function Backup-VCSAToFile {
|
|||||||
-CommonBackup will only backup the config whereas -Fullbackup grabs the historical data as well
|
-CommonBackup will only backup the config whereas -Fullbackup grabs the historical data as well
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
[Parameter(ParameterSetName=’FullBackup’)]
|
[Parameter(ParameterSetName='FullBackup')]
|
||||||
[switch]$FullBackup,
|
[switch]$FullBackup,
|
||||||
[Parameter(ParameterSetName=’CommonBackup’)]
|
[Parameter(ParameterSetName='CommonBackup')]
|
||||||
[switch]$CommonBackup,
|
[switch]$CommonBackup,
|
||||||
[ValidateSet('FTPS', 'HTTP', 'SCP', 'HTTPS', 'FTP')]
|
[ValidateSet('FTPS', 'HTTP', 'SCP', 'HTTPS', 'FTP', 'SMB')]
|
||||||
$LocationType = "FTP",
|
$LocationType = "FTP",
|
||||||
$Location,
|
$Location,
|
||||||
$LocationUser,
|
$LocationUser,
|
||||||
@@ -239,7 +239,7 @@ Function New-VCSASchedule {
|
|||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
The Below Create a schedule on Monday @11:30pm to FTP location 10.1.1.10:/vcsabackup/vcenter01
|
The Below Create a schedule on Monday @11:30pm to FTP location 10.1.1.10:/vcsabackup/vcenter01
|
||||||
and keep 4 backups with a Encryption Passowrd of "VMw@re123"
|
and keep 4 backups with a Encryption Passowrd of "VMw@re123"
|
||||||
|
|
||||||
$location = "ftp://10.1.1.10/vcsabackup/vcenter01"
|
$location = "ftp://10.1.1.10/vcsabackup/vcenter01"
|
||||||
$LocationUser = "admin"
|
$LocationUser = "admin"
|
||||||
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "VMw@re123"
|
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "VMw@re123"
|
||||||
@@ -248,14 +248,14 @@ Function New-VCSASchedule {
|
|||||||
$BDays = @("Monday")
|
$BDays = @("Monday")
|
||||||
$MaxCount = 4
|
$MaxCount = 4
|
||||||
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$BackupPassword = "VMw@re123"
|
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$BackupPassword = "VMw@re123"
|
||||||
|
|
||||||
PS C:\> New-VCSASchedule -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -BackupHour $BHour -BackupMinute $BMin -backupDays $BDays -MaxCount $MaxCount -BackupPassword $BackupPassword
|
PS C:\> New-VCSASchedule -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -BackupHour $BHour -BackupMinute $BMin -backupDays $BDays -MaxCount $MaxCount -BackupPassword $BackupPassword
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
The Below Create a schedule on Sunday & Wednesday @5:15am
|
The Below Create a schedule on Sunday & Wednesday @5:15am
|
||||||
to NFS location 10.1.1.10:/vcsabackup/vcenter01
|
to NFS location 10.1.1.10:/vcsabackup/vcenter01
|
||||||
keep 10 backups with a Encryption Passowrd of "VMw@re123"
|
keep 10 backups with a Encryption Passowrd of "VMw@re123"
|
||||||
with Event Data included (Seat) and will delete any existing schedule.
|
with Event Data included (Seat) and will delete any existing schedule.
|
||||||
|
|
||||||
$location = "nfs://10.1.1.10/vcsabackup/vcenter01"
|
$location = "nfs://10.1.1.10/vcsabackup/vcenter01"
|
||||||
$LocationUser = "admin"
|
$LocationUser = "admin"
|
||||||
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "VMw@re123"
|
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$locationPassword = "VMw@re123"
|
||||||
@@ -264,7 +264,7 @@ Function New-VCSASchedule {
|
|||||||
$BDays = @("Sunday", "Monday")
|
$BDays = @("Sunday", "Monday")
|
||||||
$MaxCount = 10
|
$MaxCount = 10
|
||||||
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$BackupPassword = "VMw@re123"
|
[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$BackupPassword = "VMw@re123"
|
||||||
|
|
||||||
PS C:\> New-VCSASchedule -IncludeSeat -force -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -BackupHour $BHour -BackupMinute $BMin -backupDays $BDays -MaxCount $MaxCount -BackupPassword $BackupPassword -CisServer "vcserver.sphere.local"
|
PS C:\> New-VCSASchedule -IncludeSeat -force -Location $location -LocationUser $LocationUser -LocationPassword $locationPassword -BackupHour $BHour -BackupMinute $BMin -backupDays $BDays -MaxCount $MaxCount -BackupPassword $BackupPassword -CisServer "vcserver.sphere.local"
|
||||||
.NOTES
|
.NOTES
|
||||||
Credit goes to @AlanRenouf & @vBrianGraf for sharing the base of this function.
|
Credit goes to @AlanRenouf & @vBrianGraf for sharing the base of this function.
|
||||||
@@ -275,11 +275,11 @@ Function New-VCSASchedule {
|
|||||||
[Parameter(Mandatory=$true)]$Location,
|
[Parameter(Mandatory=$true)]$Location,
|
||||||
[Parameter(Mandatory=$true)]$LocationUser,
|
[Parameter(Mandatory=$true)]$LocationUser,
|
||||||
[Parameter(Mandatory=$true)][VMware.VimAutomation.Cis.Core.Types.V1.Secret]$LocationPassword,
|
[Parameter(Mandatory=$true)][VMware.VimAutomation.Cis.Core.Types.V1.Secret]$LocationPassword,
|
||||||
[Parameter(Mandatory=$true)][VMware.VimAutomation.Cis.Core.Types.V1.Secret]$BackupPassword,
|
[Parameter(Mandatory=$false)][VMware.VimAutomation.Cis.Core.Types.V1.Secret]$BackupPassword,
|
||||||
[Parameter(Mandatory=$true)][ValidateRange(0,23)]$BackupHour,
|
[Parameter(Mandatory=$true)][ValidateRange(0,23)]$BackupHour,
|
||||||
[Parameter(Mandatory=$true)][ValidateRange(0,59)]$BackupMinute,
|
[Parameter(Mandatory=$true)][ValidateRange(0,59)]$BackupMinute,
|
||||||
[Parameter(Mandatory=$true)][ValidateSet('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday')][Array]$BackupDays = $null,
|
[Parameter(Mandatory=$true)][ValidateSet('MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY', 'SATURDAY', 'SUNDAY', IgnoreCase = $False)][Array]$BackupDays = $null,
|
||||||
[Parameter(Mandatory=$true)][Integer]$MaxCount,
|
[Parameter(Mandatory=$true)][Int]$MaxCount,
|
||||||
[Parameter(Mandatory=$false)]$BackupID = "default",
|
[Parameter(Mandatory=$false)]$BackupID = "default",
|
||||||
[Parameter(Mandatory=$false)]$CisServer = $global:DefaultCisServers,
|
[Parameter(Mandatory=$false)]$CisServer = $global:DefaultCisServers,
|
||||||
[Parameter(Mandatory=$false)][switch]$IncludeSeat,
|
[Parameter(Mandatory=$false)][switch]$IncludeSeat,
|
||||||
@@ -319,13 +319,13 @@ Function New-VCSASchedule {
|
|||||||
$CreateSpec.recurrence_info.Days = $BackupDays
|
$CreateSpec.recurrence_info.Days = $BackupDays
|
||||||
$CreateSpec.retention_info.max_count = $MaxCount
|
$CreateSpec.retention_info.max_count = $MaxCount
|
||||||
if ($IncludeSeat) {
|
if ($IncludeSeat) {
|
||||||
$CreateSpec.parts = @("seat")
|
$CreateSpec.parts = @("seat","common")
|
||||||
} else {
|
} else {
|
||||||
$CreateSpec.parts = @()
|
$CreateSpec.parts = @("common")
|
||||||
}
|
}
|
||||||
$CurrentSchedule = $BackupAPI.list()
|
$CurrentSchedule = $BackupAPI.list()
|
||||||
|
|
||||||
|
|
||||||
if ($CurrentSchedule.keys.value) {
|
if ($CurrentSchedule.keys.value) {
|
||||||
if($Force -or $PSCmdlet.ShouldContinue($CurrentSchedule.keys.value,'Delete Old Schedule')){
|
if($Force -or $PSCmdlet.ShouldContinue($CurrentSchedule.keys.value,'Delete Old Schedule')){
|
||||||
$BackupAPI.delete($CurrentSchedule.keys.value)
|
$BackupAPI.delete($CurrentSchedule.keys.value)
|
||||||
@@ -374,7 +374,7 @@ Function Get-VCSASchedule {
|
|||||||
PS C:\> Get-VCSASchedule -ScheduleID 1 -CisServer "vcserver.sphere.local"
|
PS C:\> Get-VCSASchedule -ScheduleID 1 -CisServer "vcserver.sphere.local"
|
||||||
.NOTES
|
.NOTES
|
||||||
Credit goes to @AlanRenouf & @vBrianGraf for sharing the base of this function.
|
Credit goes to @AlanRenouf & @vBrianGraf for sharing the base of this function.
|
||||||
Returns a simplified object with the schedule details.
|
Returns a simplified object with the schedule details.
|
||||||
You must be connected to the CisService for this to work, if you are not connected, the function will prompt you for your credentials
|
You must be connected to the CisService for this to work, if you are not connected, the function will prompt you for your credentials
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
|
|||||||
Reference in New Issue
Block a user