Merge pull request #78 from ZertoPublic/Update-Function-Tests

Update function tests
This commit is contained in:
Wes Carroll
2020-05-06 09:56:01 -04:00
committed by GitHub
48 changed files with 312 additions and 224 deletions
+88
View File
@@ -0,0 +1,88 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project is transitioning to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### General
* Removed RELEASENOTES and converted to a CHANGELOG format.
* Updated the build process to follow Semantic Versioning.
* Updated the build process to use the latest Pester Version (4.10.1)
* Updated the build process to use the latest PS Script Analyzer Version (1.19.0)
### Zerto Virtual Manager
* Refactored `Copy-ZertoVpg` functionality to leverage identifier and name maps and eliminate `where-object` searches.
* Updated `Get-ZertoEvent` parameter to fall in line with the filter parameter name in the API documentation. Moved the old parameter name to an alias to ensure that existing functionality continues to work.
## [1.4.0.20200410]
### Zerto Virtual Manager
* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/60) in the `Get-ZertoRecoveryReport` function where the `-VpgIdentifier` parameter was not working. This parameter is not accepted by the API as a valid filter and is ignored. This parameter has been removed from the function.
* Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/61) where the `Export-ZertoVpgNicSetting` function would not properly execute when run against a VM with no NICs attached.
* In reviewing the `Export-ZertoVpgNicSetting`, a review of the `Import-ZertoVpgNicSetting` was completed and it was determined to update the import logic based on various test cases. Along with this, it is now possible to reset the NIC settings to the default state with the `Import-ZertoVpgNicSetting` command. Please review the [Import-ZertoVpgNicSetting help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md) to review the updated options and import logic.
* Refactored the `Checkpoint-ZertoVpg` command to allow pipeline input (ByValue and ByProperty) for the VpgName parameter.
* Corrected a parameter typo in the `Get-ZertoVpgSetting` function. The misspelt parameter was added as an alias to ensure any existing scripts using the parameter continue to function.
* Refactored the `Get-ZertoVpg` command to remove repetitive commands and variables that are no longer required.
* Moved `Invoke-ZertoRestRequest` and `Invoke-ZARestRequest` to be public functions. As there become more and more scenarios where there are not prebuilt functions to accomplish complex specialized tasks, it became apparent that these functions could be leveraged to make the experience and workflow easier.
* Updated the `Install-ZertoVra` logic to ensure that the target datastore is available on the target host. There isn't currently any method to validate the target network, but if that becomes available in a later version of the API, the function will be updated.
* Updated the `Install-ZertoVra` function to allow for installation of the VRA using the host password method. Please review the [Install-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) documentation for syntax and examples.
* Updated the `Edit-ZertoVra` function to allow for modification of the associated ESX host password if the need arises. Please review the [Edit-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md) documentation for syntax and examples.
* Added a new function, `Set-ZertoUserCredential`, to allow the updating of the username and password used to connect the Zerto Virtual Manager to the paired hypervisor. Please see the [Set-ZertoUserCredential](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md) help for additional information.
* With the release of [Zerto 8.0](https://www.zerto.com/zerto-8-0-general-availability/) some additional API endpoints have become available.
* Updated `Get-ZertoVirtualizationSite` to add the `-repository` parameter to enable returning information for LTR repositories.
* Updated `Get-ZertoVpgSetting` to add the `-ltr` parameter to enable returning information for current LTR settings for the selected VPG.
### Zerto Analytics
* Added several functions for the newly added [Zerto Analytics](https://analytics.zerto.com) Planner.
* `Get-ZAPlannerSite` Help can be found here: [Get-ZAPlannerSite](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md)
* `Get-ZAPlannerStatsReport` Help can be found here: [Get-ZAPlannerStatsReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md)
* `Get-ZAPlannerJournalSizeReport` Help can be found here: [Get-ZAPlannerJournalSizeReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md)
* `Get-ZAPlannerNetworkPerformanceReport` Help can be found here: [Get-ZAPlannerNetworkPerformanceReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md)
* `Get-ZAPlannerWanReport` Help can be found here: [Get-ZAPlannerWanReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md)
* `Get-ZAPlannerZcasReport` Help can be found here: [Get-ZAPlannerZcasReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md)
* Created `Get-ZAProtectedVm` and `Get-ZAProtectedVmReport` functions to leverage the newly released Zerto Analytics APIs for this data. Help files can be found here: [Get-ZAProtectedVm](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md) and [Get-ZAProtectedVmReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md)
## [1.3.0.20191201]
### Zerto Virtual Manager
* [Zerto version 7.5 has been released.](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Release%20Notes.pdf) As part of this release Zerto has added API functionality that requires the following updates.
* A token is now required to pair two sites together. The need is discussed in [Issue 46](https://github.com/ZertoPublic/ZertoApiWrapper/issues/46). To implement this change a `-token` parameter has been added to the `Add-ZertoPeerSite` function.
* A new function has been added; `New-ZertoPairingToken`. This function will allow users to generate a pairing authentication token from the target ZVM to be used in the pairing process. [Issue 47](https://github.com/ZertoPublic/ZertoApiWrapper/issues/47) covers additional details.
* A new function has been added; `Invoke-ZertoEvacuateVra`. This function will allow users to evacuate a target VRA by specifying a Host Name, VRA Name, or VRA Identifier. All VMs currently replicating to the specified location will be migrated to different targets. [Issue 51](https://github.com/ZertoPublic/ZertoApiWrapper/issues/51)
* A function has been added; `Copy-ZertoVpg`. This function will allow users to copy the settings of a single VPG and add new VMs to it. There is currently no customization beyond specifying the VMs to be placed in the newly created VPG. Should additional edits \ updates be required, they should be done post creation. [Issue 54](https://github.com/ZertoPublic/ZertoApiWrapper/issues/54)
* Fixed [issue 57](https://github.com/ZertoPublic/ZertoApiWrapper/issues/57) where a `Start-ZertoFailoverTest` would throw an error complaining about validating the body parameter. This has been fixed and tested against Zerto Virtual Manager 7.5 Update 1 with Windows PowerShell 5.1 and PowerShell Core 6.2.
## [1.2.0.20190801]
### Zerto Virtual Manager
* Added two functions to aid in bulk updating of NIC information for protected VMs. ([Issue 38](https://github.com/ZertoPublic/ZertoApiWrapper/issues/38))
* [Export-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md)
* [Import-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVmNicSettings.md)
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/43) where a VPG being created with a single VM member would not be parsed by the API correctly using PowerShell 5.1
### Zerto Analytics
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/36) where the Zerto Analytics Rest Request function was not checking for the token before attempting a connection.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/40) where the `Get-ZAVpg` method would return a 404 error when a `-vpgIdentifier` parameter was specified.
### General Updates
* Updated the way that tests are invoked and parsed to ensure that both source and built module files are tested. This will ensure that what is being shipped passes all tests along with testing of the source files.
* Added additional parameter validation tests to several of the functions. On-going effort to complete stand alone unit testing of each function.
## [Initial Release]
### Zerto Virtual Manager
* Updated `Invoke-ZertoRestRequest` to work in Powershell 5.1 as well as Powershell core
### Zerto Analytics
* Implemented Zerto Analytics Functionality. Please see [Getting Started with Zerto Analytics](https://github.com/ZertoPublic/ZertoApiWrapper/wiki/Getting-Started-with-Zerto-Analytics)
-5
View File
@@ -1,5 +0,0 @@
### Zerto Virtual Manager
* Refactored `Copy-ZertoVpg` functionality to leverage identifier and name maps and eliminate `where-object` searches.
+2 -2
View File
@@ -89,7 +89,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
It "Module Scope zvmHeaders variable tests" { It "Module Scope zvmHeaders variable tests" {
$script:zvmHeaders | Should -Not -BeNullOrEmpty $script:zvmHeaders | Should -Not -BeNullOrEmpty
$script:zvmHeaders | Should -BeOfType PSCustomObject $script:zvmHeaders | Should -BeOfType PSCustomObject
$script:zvmHeaders.keys.count | Should -BeExactly 2 $script:zvmHeaders.keys.count | Should -BeExactly 3
$script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue $script:zvmHeaders.ContainsKey('x-zerto-session') | Should -BeTrue
$script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue $script:zvmHeaders.ContainsKey('Accept') | Should -BeTrue
$script:zvmHeaders['x-zerto-session'] | Should -BeOfType String $script:zvmHeaders['x-zerto-session'] | Should -BeOfType String
@@ -105,7 +105,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders $headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
It "returns a Hashtable with 2 keys" { It "returns a Hashtable with 2 keys" {
$headers | Should -BeOfType Hashtable $headers | Should -BeOfType Hashtable
$headers.keys.count | Should -Be 2 $headers.keys.count | Should -Be 3
} }
It "return value has a key called 'x-zerto-session'" { It "return value has a key called 'x-zerto-session'" {
+13 -8
View File
@@ -8,7 +8,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Get-Content $global:here\Mocks\TaskId.txt Get-Content $global:here\Mocks\TaskId.txt
} }
Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -eq "MyVraIdentifier" } { Mock -ModuleName ZertoApiWrapper Get-ZertoVra -ParameterFilter { $vraIdentifier -in @("MyVraIdentifier", "PasswordVraIdentifier") } {
Get-Content $global:here\Mocks\GetSingleVra.json -Raw | ConvertFrom-Json Get-Content $global:here\Mocks\GetSingleVra.json -Raw | ConvertFrom-Json
} }
@@ -59,6 +59,13 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_' $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
} }
It "Supports 'SupportsShouldProcess'" {
Get-Command $global:function | Should -HaveParameter WhatIf
Get-Command $global:function | Should -HaveParameter Confirm
(Get-Command $global:function).ScriptBlock | Should -Match 'SupportsShouldProcess'
(Get-Command $global:function).ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
}
} }
Context "$($global:function)::Function Unit Tests" { Context "$($global:function)::Function Unit Tests" {
@@ -82,16 +89,14 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Edit-ZertoVra -vraIdentifier "DhcpVraIdentifier" -groupName "MyNewGroup" | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" Edit-ZertoVra -vraIdentifier "DhcpVraIdentifier" -groupName "MyNewGroup" | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
} }
It "Supports 'SupportsShouldProcess'" { It "Runs with root password provided" {
Get-Command $global:function | Should -HaveParameter WhatIf $SecurePassword = 'NotARealPassword' | ConvertTo-SecureString -AsPlainText -Force
Get-Command $global:function | Should -HaveParameter Confirm Edit-ZertoVra -vraIdentifier "PasswordVraIdentifier" -HostRootPassword $SecurePassword | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
(Get-Command $global:function).ScriptBlock | Should -Match 'SupportsShouldProcess'
(Get-Command $global:function).ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
} }
} }
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 3 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -Exactly 4 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoVra -Exactly 5
} }
Remove-Variable -Name function -Scope Global Remove-Variable -Name function -Scope Global
+2 -2
View File
@@ -1,6 +1,6 @@
#Requires -Modules Pester #Requires -Modules Pester
$global:here = (Split-Path -Parent $PSCommandPath) $global:here = (Split-Path -Parent $PSCommandPath)
$global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0] $global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@@ -12,7 +12,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterTestCases = @( $ParameterTestCases = @(
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vpg'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'vpgName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'vpgIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'eventType'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' } @{ParameterName = 'siteName'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
+2 -2
View File
@@ -7,7 +7,7 @@
SkipPublisherCheck = $true SkipPublisherCheck = $true
} }
Target = 'CurrentUser' Target = 'CurrentUser'
Version = '5.5.2' Version = '5.5.11'
Tags = 'Bootstrap' Tags = 'Bootstrap'
} }
@@ -31,7 +31,7 @@
SkipPublisherCheck = $true SkipPublisherCheck = $true
} }
Target = 'CurrentUser' Target = 'CurrentUser'
Version = '1.18.1' Version = '1.18.3'
Tags = 'Bootstrap' Tags = 'Bootstrap'
} }
+9 -20
View File
@@ -1,6 +1,6 @@
#Requires -Modules 'InvokeBuild' #Requires -Modules 'InvokeBuild'
$version = "{0}.{1}" -f $(Get-Content .\version.txt), $(Get-Date -format 'yyyyMMdd') $version = "{0}" -f $(Get-Content .\version.txt)
#Define the default task #Define the default task
task . CreateArtifacts task . CreateArtifacts
@@ -54,7 +54,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, {
Severity = @('Error', 'Warning') Severity = @('Error', 'Warning')
Recurse = $true Recurse = $true
Verbose = $false Verbose = $false
ExcludeRule = @('PSUseToExportFieldsInManifest', 'PSUseBOMForUnicodeEncodedFile', 'PSUseSingularNouns') ExcludeRule = @('PSUseToExportFieldsInManifest', 'PSUseBOMForUnicodeEncodedFile', 'PSUseSingularNouns', 'PSReviewUnusedParameter')
} }
$saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams $saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams
if ($saResults) { if ($saResults) {
@@ -69,7 +69,7 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
Severity = @('Error', 'Warning') Severity = @('Error', 'Warning')
Recurse = $true Recurse = $true
Verbose = $false Verbose = $false
ExcludeRule = @('PSUseSingularNouns', 'PSUseBOMForUnicodeEncodedFile') ExcludeRule = @('PSUseSingularNouns', 'PSUseBOMForUnicodeEncodedFile', 'PSReviewUnusedParameter')
} }
$saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams $saresults = Invoke-ScriptAnalyzer @scriptAnalyzerParams
@@ -104,7 +104,7 @@ task SourceFileTests CheckPesterInstalled, {
Assert ($results.FailedCount -eq 0) $FailureMessage Assert ($results.FailedCount -eq 0) $FailureMessage
} }
task BuiltFileTests CheckPesterInstalled, { task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
ImportBuiltModule ImportBuiltModule
$testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml" $testResultsFile = "$BuildRoot\Tests\BuiltTestResults.xml"
$script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails $script:results = Invoke-Pester -Script "$BuildRoot" -Tag Unit -OutputFile $testResultsFile -PassThru -Show Fails
@@ -135,7 +135,7 @@ task UpdateMarkdownHelp CheckPlatyPSInstalled, {
#Region - Build Module Files #Region - Build Module Files
task CreatePsd1ForRelease CleanTemp, { task CreatePsd1ForRelease CleanTemp, {
$functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName } $functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName }
$releaseNotes = "# {0}{1}" -f $version, $(Get-Content .\RELEASENOTES.md -Raw) $releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version
$ManifestParams = @{ $ManifestParams = @{
Path = "$BuildRoot\temp\ZertoApiWrapper.psd1" Path = "$BuildRoot\temp\ZertoApiWrapper.psd1"
@@ -144,7 +144,7 @@ task CreatePsd1ForRelease CleanTemp, {
GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325' GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325'
Author = 'Wes Carroll' Author = 'Wes Carroll'
CompanyName = 'Zerto' CompanyName = 'Zerto'
Copyright = '(c) {0} Wes Carroll. All rights reserved.' -f $(Get-Date -format 'yyyy') Copyright = '(c) {0} Wes Carroll. All rights reserved.' -f $(Get-Date -Format 'yyyy')
Description = 'Windows PowerShell and PowerShell Core API Wrapper Module for Zerto Virtual Manager' Description = 'Windows PowerShell and PowerShell Core API Wrapper Module for Zerto Virtual Manager'
PowerShellVersion = '5.1.0' PowerShellVersion = '5.1.0'
ProjectUri = 'https://github.com/ZertoPublic/ZertoApiWrapper' ProjectUri = 'https://github.com/ZertoPublic/ZertoApiWrapper'
@@ -165,17 +165,6 @@ task CreatePsm1ForRelease CreatePsd1ForRelease, {
$lines = '#------------------------------------------------------------#' $lines = '#------------------------------------------------------------#'
$Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop ) $Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop )
$Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop ) $Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop )
<# $functionCount = 0
$exportString = ""
foreach ($file in $Public) {
if ($functionCount -eq 0) {
$functionCount++
$exportString = "{0}" -f $file.BaseName
} else {
$functionCount++
$exportString = "{0}, {1}" -f $exportString, $file.BaseName
}
} #>
Add-Content -Path $psm1Path -Value $lines Add-Content -Path $psm1Path -Value $lines
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#"
Add-Content -Path $psm1Path -Value $lines Add-Content -Path $psm1Path -Value $lines
@@ -204,9 +193,9 @@ task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTest
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
} }
Compress-Archive -Path .\temp\* -DestinationPath .\publish\ZertoApiWrapper.zip Compress-Archive -Path .\temp\* -DestinationPath .\publish\ZertoApiWrapper.zip
ImportBuiltModule #ImportBuiltModule
(Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.txt #(Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.txt
(Get-Module ZertoApiWrapper).Version.ToString() | Add-Content .\publish\release-version.txt #(Get-Module ZertoApiWrapper).Version.ToString() | Add-Content .\publish\release-version.txt
Copy-Item "$BuildRoot\ZertoApiWrapper.build.ps1" "$BuildRoot\publish\ZertoApiWrapper.build.ps1" Copy-Item "$BuildRoot\ZertoApiWrapper.build.ps1" "$BuildRoot\publish\ZertoApiWrapper.build.ps1"
Copy-Item "$BuildRoot\ZertoApiWrapper.Depend.psd1" "$BuildRoot\publish\ZertoApiWrapper.Depend.psd1" Copy-Item "$BuildRoot\ZertoApiWrapper.Depend.psd1" "$BuildRoot\publish\ZertoApiWrapper.Depend.psd1"
Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1" Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1"
@@ -3,7 +3,7 @@ function Get-ZertoApiFilter {
[Outputtype([String])] [Outputtype([String])]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Hashtable that contains filter keys and values" HelpMessage = "Hashtable that contains filter keys and values"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
+1 -1
View File
@@ -3,7 +3,7 @@ function Add-ZertoPeerSite {
[cmdletbinding( SupportsShouldProcess = $true )] [cmdletbinding( SupportsShouldProcess = $true )]
param( param(
[parameter( [parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Target Hostname or IP address to pair the localsite to." HelpMessage = "Target Hostname or IP address to pair the localsite to."
)] )]
[ValidateScript( { $_ -match [IPAddress]$_ } )] [ValidateScript( { $_ -match [IPAddress]$_ } )]
@@ -3,7 +3,7 @@ function Checkpoint-ZertoVpg {
[cmdletbinding()] [cmdletbinding()]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Name of the VPG to tag.", HelpMessage = "Name of the VPG to tag.",
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true ValueFromPipelineByPropertyName = $true
@@ -11,7 +11,7 @@ function Checkpoint-ZertoVpg {
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Text to tag the checkpoint with." HelpMessage = "Text to tag the checkpoint with."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -27,10 +27,10 @@ function Checkpoint-ZertoVpg {
$vpgIdentifier = $(get-zertovpg -name $name).vpgIdentifier $vpgIdentifier = $(get-zertovpg -name $name).vpgIdentifier
if ($vpgIdentifier) { if ($vpgIdentifier) {
$uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier $uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier
$body = @{"checkpointName" = $checkpointName} $body = @{"checkpointName" = $checkpointName }
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST" Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST"
} else { } else {
Write-Output "Cannot find VPG named $name. Please check the name and try again." Write-Output "Cannot find VPG named $name. Please check the name and try again."
} }
} }
} }
@@ -3,7 +3,7 @@ function Connect-ZertoAnalytics {
[cmdletbinding()] [cmdletbinding()]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "PSCredential Object containing username and password authorized for the Zerto Analytics site", HelpMessage = "PSCredential Object containing username and password authorized for the Zerto Analytics site",
Position = 0 Position = 0
)] )]
@@ -17,4 +17,4 @@ function Connect-ZertoAnalytics {
$result = Invoke-ZARestRequest -Uri $uri -body $($body | ConvertTo-Json) -Method POST $result = Invoke-ZARestRequest -Uri $uri -body $($body | ConvertTo-Json) -Method POST
$Script:zaHeaders["Authorization"] = "Bearer $($result.Token)" $Script:zaHeaders["Authorization"] = "Bearer $($result.Token)"
$Script:zaHeaders $Script:zaHeaders
} }
+10 -7
View File
@@ -4,7 +4,7 @@ function Connect-ZertoServer {
[OutputType([hashtable])] [OutputType([hashtable])]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "IP address or FQDN of your Zerto Management Server" HelpMessage = "IP address or FQDN of your Zerto Management Server"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -18,7 +18,7 @@ function Connect-ZertoServer {
[Alias("port")] [Alias("port")]
[string]$zertoPort = "9669", [string]$zertoPort = "9669",
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Valid credentials to connect to the Zerto Management Server" HelpMessage = "Valid credentials to connect to the Zerto Management Server"
)] )]
[System.Management.Automation.PSCredential]$credential, [System.Management.Automation.PSCredential]$credential,
@@ -32,9 +32,12 @@ function Connect-ZertoServer {
Set-Variable -Name zvmServer -Scope Script -Value $zertoServer Set-Variable -Name zvmServer -Scope Script -Value $zertoServer
Set-Variable -Name zvmPort -Scope Script -Value $zertoPort Set-Variable -Name zvmPort -Scope Script -Value $zertoPort
# Set zvmLastAction Variable to keep track when the API token expires # Set zvmLastAction Variable to keep track when the API token expires
Set-Variable -Name zvmLastAction -Scope Script -Value $(get-date).Ticks Set-Variable -Name zvmLastAction -Scope Script -Value $(Get-Date).Ticks
# Set / Clear the zvmHeaders to clear any existing token # Set / Clear the zvmHeaders to clear any existing token
Set-Variable -Name zvmHeaders -Scope Script -Value $null Set-Variable -Name zvmHeaders -Scope Script -Value @{
"Accept" = "application/json"
"zerto-triggered-by" = "PowershellWes"
}
} }
process { process {
@@ -44,14 +47,14 @@ function Connect-ZertoServer {
end { end {
# Build Headers Hashtable with Authorization Token # Build Headers Hashtable with Authorization Token
$zertoAuthorizationHeaders = @{"x-zerto-session" = $results.Headers['x-zerto-session'][0].ToString(); "Accept" = "application/json"} $Script:zvmHeaders['x-zerto-session'] = $results.Headers['x-zerto-session'][0].ToString()
# Set common Script Scope Variables to be used other functions (Headers and Local Site Info) # Set common Script Scope Variables to be used other functions (Headers and Local Site Info)
Set-Variable -Name zvmHeaders -Scope Script -Value $zertoAuthorizationHeaders # Set-Variable -Name zvmHeaders -Scope Script -Value $zertoAuthorizationHeaders
Set-Variable -Name zvmLocalInfo -Scope Script -Value (Get-ZertoLocalSite) Set-Variable -Name zvmLocalInfo -Scope Script -Value (Get-ZertoLocalSite)
# Have the option to return the headers to a variable # Have the option to return the headers to a variable
if ($returnHeaders) { if ($returnHeaders) {
return $zertoAuthorizationHeaders return $Script:zvmHeaders
} }
} }
} }
+1 -1
View File
@@ -3,7 +3,7 @@ function Edit-ZertoVra {
[cmdletbinding( SupportsShouldProcess = $true )] [cmdletbinding( SupportsShouldProcess = $true )]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Identifier of the VRA to be updated." HelpMessage = "Identifier of the VRA to be updated."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
+3 -3
View File
@@ -4,7 +4,7 @@ function Export-ZertoVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "Location where to dump the resulting JSON files containing the VPG Settings", HelpMessage = "Location where to dump the resulting JSON files containing the VPG Settings",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("outputFolder")] [Alias("outputFolder")]
@@ -12,7 +12,7 @@ function Export-ZertoVpg {
[parameter( [parameter(
HelpMessage = "Name(s) of the VPG(s) to be exported", HelpMessage = "Name(s) of the VPG(s) to be exported",
ParameterSetName = "namedVpgs", ParameterSetName = "namedVpgs",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
@@ -21,7 +21,7 @@ function Export-ZertoVpg {
ParameterSetName = "allVpgs", ParameterSetName = "allVpgs",
valuefrompipeline = $true, valuefrompipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
Mandatory = $true Mandatory
)] )]
[switch]$allVpgs [switch]$allVpgs
) )
+1 -1
View File
@@ -17,7 +17,7 @@ function Get-ZAAlert {
[Parameter( [Parameter(
HelpMessage = "The alert Idnetifier", HelpMessage = "The alert Idnetifier",
ParameterSetName = "alertId", ParameterSetName = "alertId",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$alertIdentifier [string]$alertIdentifier
+5 -5
View File
@@ -4,15 +4,15 @@ function Get-ZADatastore {
param ( param (
[Parameter( [Parameter(
HelpMessage = "The site identifier. The site identifier is mandatory. Omit the datastore and datastore cluster identifiers to view site level storage information.", HelpMessage = "The site identifier. The site identifier is mandatory. Omit the datastore and datastore cluster identifiers to view site level storage information.",
Mandatory = $true, Mandatory,
ParameterSetName = "AllInfo" ParameterSetName = "AllInfo"
)] )]
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
ParameterSetName = "cluster" ParameterSetName = "cluster"
)] )]
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
ParameterSetName = "datastore" ParameterSetName = "datastore"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -20,14 +20,14 @@ function Get-ZADatastore {
[Parameter( [Parameter(
HelpMessage = "The datastore cluster identifier. Gets a list of datastores in the cluster.", HelpMessage = "The datastore cluster identifier. Gets a list of datastores in the cluster.",
ParameterSetName = "cluster", ParameterSetName = "cluster",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$clusterIdentifier, [string]$clusterIdentifier,
[Parameter( [Parameter(
HelpMessage = "The datastore identifer. Gets the datastore info.", HelpMessage = "The datastore identifer. Gets the datastore info.",
ParameterSetName = "datastore", ParameterSetName = "datastore",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$datastoreIdentifier [string]$datastoreIdentifier
+1 -1
View File
@@ -17,7 +17,7 @@ function Get-ZATask {
[Parameter( [Parameter(
HelpMessage = "The task Idnetifier", HelpMessage = "The task Idnetifier",
ParameterSetName = "taskId", ParameterSetName = "taskId",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$taskIdentifier [string]$taskIdentifier
+1 -1
View File
@@ -11,7 +11,7 @@ function Get-ZAVpg {
[Parameter( [Parameter(
HelpMessage = "The VPG Identifier", HelpMessage = "The VPG Identifier",
ParameterSetName = "vpg", ParameterSetName = "vpg",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$vpgIdentifier [string]$vpgIdentifier
+4 -4
View File
@@ -4,7 +4,7 @@ function Get-ZertoAlert {
param( param(
[Parameter( [Parameter(
ParameterSetName = "alertId", ParameterSetName = "alertId",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true , ValueFromPipelineByPropertyName = $true ,
HelpMessage = "AlertId or array of AlertIds to be queried" HelpMessage = "AlertId or array of AlertIds to be queried"
@@ -13,19 +13,19 @@ function Get-ZertoAlert {
[string[]]$alertId, [string[]]$alertId,
[Parameter( [Parameter(
ParameterSetName = "entities", ParameterSetName = "entities",
Mandatory = $true, Mandatory,
HelpMessage = "Switch to return the entities information from the API" HelpMessage = "Switch to return the entities information from the API"
)] )]
[switch]$entities, [switch]$entities,
[Parameter( [Parameter(
ParameterSetName = "helpIdentifiers", ParameterSetName = "helpIdentifiers",
Mandatory = $true, Mandatory,
HelpMessage = "Switch to get the Help Identifiers information from the API" HelpMessage = "Switch to get the Help Identifiers information from the API"
)] )]
[switch]$helpIdentifiers, [switch]$helpIdentifiers,
[Parameter( [Parameter(
ParameterSetName = "levels", ParameterSetName = "levels",
Mandatory = $true, Mandatory,
HelpMessage = "Switch to return Alert Levels information from the API" HelpMessage = "Switch to return Alert Levels information from the API"
)] )]
[switch]$levels, [switch]$levels,
+7 -7
View File
@@ -19,8 +19,8 @@ function Get-ZertoEvent {
HelpMessage = "The name of the VPG for which you want to return events." HelpMessage = "The name of the VPG for which you want to return events."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("vpgName")] [Alias("vpg")]
[string]$vpg, [string]$vpgName,
[Parameter( [Parameter(
ParameterSetName = "filter", ParameterSetName = "filter",
HelpMessage = "The identifier of the VPG for which you want to return events." HelpMessage = "The identifier of the VPG for which you want to return events."
@@ -69,7 +69,7 @@ function Get-ZertoEvent {
ParameterSetName = "filter", ParameterSetName = "filter",
HelpMessage = "The type of event to return. This filter behaves in the same way as the eventCategory filter. Possible Values are: Possible Values are: 'All', 'Events', 'Alerts'" HelpMessage = "The type of event to return. This filter behaves in the same way as the eventCategory filter. Possible Values are: Possible Values are: 'All', 'Events', 'Alerts'"
)] )]
[ValidateSet('All','Events','Alerts')] [ValidateSet('All', 'Events', 'Alerts')]
[string]$category, [string]$category,
[Parameter( [Parameter(
ParameterSetName = "filter", ParameterSetName = "filter",
@@ -86,7 +86,7 @@ function Get-ZertoEvent {
[string]$alertIdentifier, [string]$alertIdentifier,
[Parameter( [Parameter(
ParameterSetName = "eventId", ParameterSetName = "eventId",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
HelpMessage = "The identifier or identifiers of the event for which information is returned." HelpMessage = "The identifier or identifiers of the event for which information is returned."
@@ -95,19 +95,19 @@ function Get-ZertoEvent {
[string[]]$eventId, [string[]]$eventId,
[Parameter( [Parameter(
ParameterSetName = "categories", ParameterSetName = "categories",
Mandatory = $true, Mandatory,
HelpMessage = "Returns possible Event Categories." HelpMessage = "Returns possible Event Categories."
)] )]
[switch]$categories, [switch]$categories,
[Parameter( [Parameter(
ParameterSetName = "entities", ParameterSetName = "entities",
Mandatory = $true, Mandatory,
HelpMessage = "Returns possible entity types." HelpMessage = "Returns possible entity types."
)] )]
[switch]$entities, [switch]$entities,
[Parameter( [Parameter(
ParameterSetName = "types", ParameterSetName = "types",
Mandatory = $true, Mandatory,
HelpMessage = "Returns possible event types.")] HelpMessage = "Returns possible event types.")]
[switch]$types [switch]$types
) )
+2 -2
View File
@@ -5,12 +5,12 @@ function Get-ZertoPeerSite {
[Parameter( [Parameter(
ParameterSetName = "pairingStatuses", ParameterSetName = "pairingStatuses",
HelpMessage = "Switch to return possible paiting statuses.", HelpMessage = "Switch to return possible paiting statuses.",
Mandatory = $true Mandatory
)] )]
[switch]$pairingStatuses, [switch]$pairingStatuses,
[Parameter( [Parameter(
ParameterSetName = "siteIdentifier", ParameterSetName = "siteIdentifier",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
HelpMessage = "The identifier(s) of the peer site(s) for which information is to be returned." HelpMessage = "The identifier(s) of the peer site(s) for which information is to be returned."
@@ -4,7 +4,7 @@ function Get-ZertoProtectedVm {
param ( param (
[Parameter( [Parameter(
ParameterSetName = "vmIdentifier", ParameterSetName = "vmIdentifier",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
HelpMessage = "vmIdentifier(s) for which to return information" HelpMessage = "vmIdentifier(s) for which to return information"
@@ -4,57 +4,57 @@ function Get-ZertoVirtualizationSite {
param( param(
[Parameter( [Parameter(
ParameterSetName = "siteIdentifier", ParameterSetName = "siteIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "datastoreClusters", ParameterSetName = "datastoreClusters",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "datastores", ParameterSetName = "datastores",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "hostClusters", ParameterSetName = "hostClusters",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "hosts", ParameterSetName = "hosts",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "networks", ParameterSetName = "networks",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "resourcePools", ParameterSetName = "resourcePools",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "vms", ParameterSetName = "vms",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "devices", ParameterSetName = "devices",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "folders", ParameterSetName = "folders",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter( [Parameter(
ParameterSetName = "repositories", ParameterSetName = "repositories",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -62,19 +62,19 @@ function Get-ZertoVirtualizationSite {
[string]$siteIdentifier, [string]$siteIdentifier,
[Parameter( [Parameter(
ParameterSetName = "datastoreClusters", ParameterSetName = "datastoreClusters",
Mandatory = $true, Mandatory,
HelpMessage = "When selected, will return all datastore clusters at the specified site." HelpMessage = "When selected, will return all datastore clusters at the specified site."
)] )]
[switch]$datastoreClusters, [switch]$datastoreClusters,
[Parameter( [Parameter(
ParameterSetName = "datastores", ParameterSetName = "datastores",
Mandatory = $true, Mandatory,
HelpMessage = "When selected, will return all datastores at the specified site." HelpMessage = "When selected, will return all datastores at the specified site."
)] )]
[switch]$datastores, [switch]$datastores,
[Parameter( [Parameter(
ParameterSetName = "devices", ParameterSetName = "devices",
Mandatory = $true, Mandatory,
HelpMessage = "When selected, will return all devices at the specified site." HelpMessage = "When selected, will return all devices at the specified site."
)] )]
[switch]$devices, [switch]$devices,
@@ -93,43 +93,43 @@ function Get-ZertoVirtualizationSite {
[string]$hostIdentifier, [string]$hostIdentifier,
[Parameter( [Parameter(
ParameterSetName = "folders", ParameterSetName = "folders",
Mandatory = $true, Mandatory,
HelpMessage = "Return all folders at the selected site." HelpMessage = "Return all folders at the selected site."
)] )]
[switch]$folders, [switch]$folders,
[Parameter( [Parameter(
ParameterSetName = "hostClusters", ParameterSetName = "hostClusters",
Mandatory = $true, Mandatory,
HelpMessage = "Return all host clusters at the selected site." HelpMessage = "Return all host clusters at the selected site."
)] )]
[switch]$hostClusters, [switch]$hostClusters,
[Parameter( [Parameter(
ParameterSetName = "hosts", ParameterSetName = "hosts",
Mandatory = $true, Mandatory,
HelpMessage = "Return all hosts at the selected site. If a host identifier is provided, return only that host." HelpMessage = "Return all hosts at the selected site. If a host identifier is provided, return only that host."
)] )]
[switch]$hosts, [switch]$hosts,
[Parameter( [Parameter(
ParameterSetName = "networks", ParameterSetName = "networks",
Mandatory = $true, Mandatory,
HelpMessage = "Return all networks at the selected site." HelpMessage = "Return all networks at the selected site."
)] )]
[switch]$networks, [switch]$networks,
[Parameter( [Parameter(
ParameterSetName = "resourcePools", ParameterSetName = "resourcePools",
Mandatory = $true, Mandatory,
HelpMessage = "Return all resource pools at the selected site." HelpMessage = "Return all resource pools at the selected site."
)] )]
[switch]$resourcePools, [switch]$resourcePools,
[Parameter( [Parameter(
ParameterSetName = "vms", ParameterSetName = "vms",
Mandatory = $true, Mandatory,
HelpMessage = "Return all VMs at the selected site." HelpMessage = "Return all VMs at the selected site."
)] )]
[switch]$vms, [switch]$vms,
[Parameter( [Parameter(
ParameterSetName = "repositories", ParameterSetName = "repositories",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[switch]$repositories [switch]$repositories
+12 -12
View File
@@ -4,17 +4,17 @@ function Get-ZertoVpg {
param( param(
[Parameter( [Parameter(
ParameterSetName = "protectionGroupIdentifier", ParameterSetName = "protectionGroupIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier(s) of the Virtual Protection Group to return" HelpMessage = "The identifier(s) of the Virtual Protection Group to return"
)] )]
[Parameter( [Parameter(
ParameterSetName = "checkpoints", ParameterSetName = "checkpoints",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier(s) of the Virtual Protection Group to return" HelpMessage = "The identifier(s) of the Virtual Protection Group to return"
)] )]
[Parameter( [Parameter(
ParameterSetName = "stats", ParameterSetName = "stats",
Mandatory = $true, Mandatory,
HelpMessage = "The identifier(s) of the Virtual Protection Group to return" HelpMessage = "The identifier(s) of the Virtual Protection Group to return"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -22,7 +22,7 @@ function Get-ZertoVpg {
[string[]]$protectionGroupIdentifier, [string[]]$protectionGroupIdentifier,
[Parameter( [Parameter(
ParameterSetName = "checkpoints", ParameterSetName = "checkpoints",
Mandatory = $true, Mandatory,
HelpMessage = "Return checkpoints for the selected Virtual Protection Group." HelpMessage = "Return checkpoints for the selected Virtual Protection Group."
)] )]
[switch]$checkpoints, [switch]$checkpoints,
@@ -39,49 +39,49 @@ function Get-ZertoVpg {
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$endDate, [string]$endDate,
[Parameter( [Parameter(
ParameterSetName = "stats", Mandatory = $true, ParameterSetName = "stats", Mandatory,
HelpMessage = "Return earliest and latest checkpoints for the selected Virtual Protection Group" HelpMessage = "Return earliest and latest checkpoints for the selected Virtual Protection Group"
)] )]
[switch]$checkpointsStats, [switch]$checkpointsStats,
[Parameter( [Parameter(
ParameterSetName = "entityTypes", ParameterSetName = "entityTypes",
Mandatory = $true, Mandatory,
HelpMessage = "Return Valid VPG entityTypes" HelpMessage = "Return Valid VPG entityTypes"
)] )]
[switch]$entityTypes, [switch]$entityTypes,
[Parameter( [Parameter(
ParameterSetName = "failoverCommitPolicies", ParameterSetName = "failoverCommitPolicies",
Mandatory = $true, Mandatory,
HelpMessage = "Valid Failover Commit Policies" HelpMessage = "Valid Failover Commit Policies"
)] )]
[switch]$failoverCommitPolicies, [switch]$failoverCommitPolicies,
[Parameter( [Parameter(
ParameterSetName = "failoverShutdownPolicies", ParameterSetName = "failoverShutdownPolicies",
Mandatory = $true, Mandatory,
HelpMessage = "Valid Failover Shutdown Policies" HelpMessage = "Valid Failover Shutdown Policies"
)] )]
[switch]$failoverShutdownPolicies, [switch]$failoverShutdownPolicies,
[Parameter( [Parameter(
ParameterSetName = "priorities", ParameterSetName = "priorities",
Mandatory = $true, Mandatory,
HelpMessage = "Valid VPG priorities" HelpMessage = "Valid VPG priorities"
)] )]
[switch]$priorities, [switch]$priorities,
[Parameter( [Parameter(
ParameterSetName = "retentionPolicies", ParameterSetName = "retentionPolicies",
Mandatory = $true, Mandatory,
HelpMessage = "Valid retention policies" HelpMessage = "Valid retention policies"
)] )]
[switch]$retentionPolicies, [switch]$retentionPolicies,
[Parameter( [Parameter(
ParameterSetName = "statuses", ParameterSetName = "statuses",
Mandatory = $true, Mandatory,
HelpMessage = "Valid VPG statuses" HelpMessage = "Valid VPG statuses"
)] )]
[switch]$statuses, [switch]$statuses,
[Parameter( [Parameter(
ParameterSetName = "subStatuses", ParameterSetName = "subStatuses",
Mandatory = $true, Mandatory,
HelpMessage = "Valid VPG sub statuses" HelpMessage = "Valid VPG sub statuses"
)] )]
[switch]$subStatuses, [switch]$subStatuses,
+41 -41
View File
@@ -10,7 +10,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -18,7 +18,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." HelpMessage = "The identifier of the VPG settings object for which information is retrieved. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[Parameter( [Parameter(
@@ -26,7 +26,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -34,7 +34,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -42,7 +42,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -50,7 +50,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -58,7 +58,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -66,7 +66,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -74,7 +74,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -82,7 +82,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -90,7 +90,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -98,7 +98,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -106,7 +106,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -114,7 +114,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -122,7 +122,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -130,7 +130,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -138,7 +138,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -146,7 +146,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter( [Parameter(
@@ -154,7 +154,7 @@ function Get-ZertoVpgSetting {
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -162,100 +162,100 @@ function Get-ZertoVpgSetting {
[string[]]$vpgSettingsIdentifier, [string[]]$vpgSettingsIdentifier,
[Parameter( [Parameter(
ParameterSetName = "backup", ParameterSetName = "backup",
Mandatory = $true, Mandatory,
HelpMessage = "Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." HelpMessage = "Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$backup, [switch]$backup,
[Parameter( [Parameter(
ParameterSetName = "dayOfWeek", ParameterSetName = "dayOfWeek",
Mandatory = $true, Mandatory,
HelpMessage = "Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." HelpMessage = "Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$dayOfWeek, [switch]$dayOfWeek,
[Parameter( [Parameter(
ParameterSetName = "retentionPeriod", ParameterSetName = "retentionPeriod",
Mandatory = $true, Mandatory,
HelpMessage = "Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." HelpMessage = "Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$retentionPeriod, [switch]$retentionPeriod,
[Parameter( [Parameter(
ParameterSetName = "schedulerPeriod", ParameterSetName = "schedulerPeriod",
Mandatory = $true, Mandatory,
HelpMessage = "Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." HelpMessage = "Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$schedulerPeriod, [switch]$schedulerPeriod,
[Parameter( [Parameter(
ParameterSetName = "basic", ParameterSetName = "basic",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Basic Settings" HelpMessage = "Get VPG Basic Settings"
)] )]
[switch]$basic, [switch]$basic,
[Parameter( [Parameter(
ParameterSetName = "bootGroup", ParameterSetName = "bootGroup",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Boot Settings" HelpMessage = "Get VPG Boot Settings"
)] )]
[switch]$bootgroup, [switch]$bootgroup,
[Parameter( [Parameter(
ParameterSetName = "journal", ParameterSetName = "journal",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Journal Settings" HelpMessage = "Get VPG Journal Settings"
)] )]
[switch]$journal, [switch]$journal,
[Parameter( [Parameter(
ParameterSetName = "networks", ParameterSetName = "networks",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Network Settings" HelpMessage = "Get VPG Network Settings"
)] )]
[switch]$networks, [switch]$networks,
[Parameter( [Parameter(
ParameterSetName = "priority", ParameterSetName = "priority",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Priority Settings" HelpMessage = "Get VPG Priority Settings"
)] )]
[switch]$priority, [switch]$priority,
[Parameter( [Parameter(
ParameterSetName = "recovery", ParameterSetName = "recovery",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Recovery Settings" HelpMessage = "Get VPG Recovery Settings"
)] )]
[Alias("rcovery")] [Alias("rcovery")]
[switch]$recovery, [switch]$recovery,
[Parameter( [Parameter(
ParameterSetName = "scripting", ParameterSetName = "scripting",
Mandatory = $true, Mandatory,
HelpMessage = "Get VPG Recovery Settings" HelpMessage = "Get VPG Recovery Settings"
)] )]
[switch]$scripting, [switch]$scripting,
[Parameter( [Parameter(
ParameterSetName = "vms", ParameterSetName = "vms",
Mandatory = $true, Mandatory,
HelpMessage = "Get all settings for all VMs in a VPG." HelpMessage = "Get all settings for all VMs in a VPG."
)] )]
[switch]$vms, [switch]$vms,
[Parameter( [Parameter(
ParameterSetName = "vmIdentifier", ParameterSetName = "vmIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "Get all settings for selected VM" HelpMessage = "Get all settings for selected VM"
)] )]
[Parameter( [Parameter(
ParameterSetName = "nics", ParameterSetName = "nics",
Mandatory = $true, Mandatory,
HelpMessage = "VM Identifier" HelpMessage = "VM Identifier"
)] )]
[Parameter( [Parameter(
ParameterSetName = "volumes", ParameterSetName = "volumes",
Mandatory = $true, Mandatory,
HelpMessage = "VM Identifier" HelpMessage = "VM Identifier"
)] )]
[Parameter( [Parameter(
ParameterSetName = "nicIdentifier", ParameterSetName = "nicIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "VM Identifier" HelpMessage = "VM Identifier"
)] )]
[Parameter( [Parameter(
ParameterSetName = "volumeIdentifier", ParameterSetName = "volumeIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "VM Identifier" HelpMessage = "VM Identifier"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -263,13 +263,13 @@ function Get-ZertoVpgSetting {
[string]$vmIdentifier, [string]$vmIdentifier,
[Parameter( [Parameter(
ParameterSetName = "nics", ParameterSetName = "nics",
Mandatory = $true, Mandatory,
HelpMessage = "Return NIC information for all NICs of the specified VM" HelpMessage = "Return NIC information for all NICs of the specified VM"
)] )]
[switch]$nics, [switch]$nics,
[Parameter( [Parameter(
ParameterSetName = "nicIdentifier", ParameterSetName = "nicIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "Return NIC information for specified NIC of the specified VM" HelpMessage = "Return NIC information for specified NIC of the specified VM"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -277,13 +277,13 @@ function Get-ZertoVpgSetting {
[string]$nicIdentifier, [string]$nicIdentifier,
[Parameter( [Parameter(
ParameterSetName = "volumes", ParameterSetName = "volumes",
Mandatory = $true, Mandatory,
HelpMessage = "Return Volume information for all volumes of the specified VM" HelpMessage = "Return Volume information for all volumes of the specified VM"
)] )]
[switch]$volumes, [switch]$volumes,
[Parameter( [Parameter(
ParameterSetName = "volumeIdentifier", ParameterSetName = "volumeIdentifier",
Mandatory = $true, Mandatory,
HelpMessage = "Return volume information for the specified volume of the specified VM" HelpMessage = "Return volume information for the specified volume of the specified VM"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -291,7 +291,7 @@ function Get-ZertoVpgSetting {
[string]$volumeIdentifier, [string]$volumeIdentifier,
[Parameter( [Parameter(
ParameterSetName = "ltr", ParameterSetName = "ltr",
Mandatory = $true, Mandatory,
HelpMessage = "Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error." HelpMessage = "Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error."
)] )]
[switch]$ltr [switch]$ltr
+1 -1
View File
@@ -4,7 +4,7 @@ function Import-ZertoVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "VPG settings JSON file(s) to import.", HelpMessage = "VPG settings JSON file(s) to import.",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true ValueFromPipelineByPropertyName = $true
)] )]
@@ -4,7 +4,7 @@ function Invoke-ZertoFailover {
param( param(
#TODO - Refactor? #TODO - Refactor?
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Name of the VPG to Failover" HelpMessage = "Name of the VPG to Failover"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -54,7 +54,7 @@ function Invoke-ZertoFailover {
Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop
} }
$baseUri = "vpgs/{0}/failover" -f $vpgId $baseUri = "vpgs/{0}/failover" -f $vpgId
$body = @{} $body = @{ }
# Setup Required Defaults # Setup Required Defaults
$body['commitpolicy'] = $commitPolicy $body['commitpolicy'] = $commitPolicy
$body['TimeToWaitBeforeShutdownInSec'] = $timeToWaitBeforeShutdownInSec $body['TimeToWaitBeforeShutdownInSec'] = $timeToWaitBeforeShutdownInSec
@@ -76,7 +76,7 @@ function Invoke-ZertoFailover {
$vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName
[System.Collections.ArrayList]$vmIdentifiers = @() [System.Collections.ArrayList]$vmIdentifiers = @()
foreach ( $name in $vmName ) { foreach ( $name in $vmName ) {
$selectedVm = $vpgVmInformation | Where-Object {$_.VmName.toLower() -eq $name.toLower()} $selectedVm = $vpgVmInformation | Where-Object { $_.VmName.toLower() -eq $name.toLower() }
if ($null -eq $selectedVm) { if ($null -eq $selectedVm) {
Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop
} elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) {
@@ -4,7 +4,7 @@ function Invoke-ZertoFailoverCommit {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of the VPG(s) to commit.", HelpMessage = "Name(s) of the VPG(s) to commit.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
@@ -4,7 +4,7 @@ function Invoke-ZertoFailoverRollback {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of VPG(s) to roll back from failing over", HelpMessage = "Name(s) of VPG(s) to roll back from failing over",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
@@ -4,7 +4,7 @@ function Invoke-ZertoForceSync {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of VPG(s) to force sync", HelpMessage = "Name(s) of VPG(s) to force sync",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
+3 -3
View File
@@ -4,7 +4,7 @@ function Invoke-ZertoMove {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of the VPG(s) you want to move.", HelpMessage = "Name(s) of the VPG(s) you want to move.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
@@ -29,13 +29,13 @@ function Invoke-ZertoMove {
[Parameter( [Parameter(
ParameterSetName = "disableReverseProtection", ParameterSetName = "disableReverseProtection",
HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.", HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.",
Mandatory = $true Mandatory
)] )]
[switch]$disableReverseProtection, [switch]$disableReverseProtection,
[Parameter( [Parameter(
ParameterSetName = "keepSourceVms", ParameterSetName = "keepSourceVms",
HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.", HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.",
Mandatory = $true Mandatory
)] )]
[switch]$keepSourceVms, [switch]$keepSourceVms,
[Parameter( [Parameter(
@@ -4,7 +4,7 @@ function Invoke-ZertoMoveCommit {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of the VPG(s) to commit.", HelpMessage = "Name(s) of the VPG(s) to commit.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
@@ -20,7 +20,7 @@ function Invoke-ZertoMoveCommit {
begin { begin {
$baseUri = "vpgs" $baseUri = "vpgs"
$body = @{} $body = @{ }
if ($reverseProtection) { if ($reverseProtection) {
$body["ReverseProtection"] = $true $body["ReverseProtection"] = $true
} elseif ($keepSourceVms) { } elseif ($keepSourceVms) {
@@ -4,7 +4,7 @@ function Invoke-ZertoMoveRollback {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of VPG(s) to roll back from failing over", HelpMessage = "Name(s) of VPG(s) to roll back from failing over",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
+18 -18
View File
@@ -4,7 +4,7 @@ function New-ZertoVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name of the VPG", HelpMessage = "Name of the VPG",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$vpgName, [string]$vpgName,
@@ -20,89 +20,89 @@ function New-ZertoVpg {
[int]$journalHistoryInHours = 24, [int]$journalHistoryInHours = 24,
[Parameter( [Parameter(
HelpMessage = "Name(s) of the VM(s) to be protected.", HelpMessage = "Name(s) of the VM(s) to be protected.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$protectedVm, [string[]]$protectedVm,
[Parameter( [Parameter(
HelpMessage = "Name of the site where the VM(s) will be recovered", HelpMessage = "Name of the site where the VM(s) will be recovered",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$recoverySite, [string]$recoverySite,
[Parameter( [Parameter(
HelpMessage = "Name of the cluster where the VM(s) will be recovered.", HelpMessage = "Name of the cluster where the VM(s) will be recovered.",
ParameterSetName = "recoveryClusterDatastore", ParameterSetName = "recoveryClusterDatastore",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the cluster where the VM(s) will be recovered.", HelpMessage = "Name of the cluster where the VM(s) will be recovered.",
ParameterSetName = "recoveryClusterDatastoreCluster", ParameterSetName = "recoveryClusterDatastoreCluster",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$recoveryCluster, [string]$recoveryCluster,
[Parameter( [Parameter(
HelpMessage = "Name of the host where the VM(s) will be recovered.", HelpMessage = "Name of the host where the VM(s) will be recovered.",
ParameterSetName = "recoveryHostDatastore", ParameterSetName = "recoveryHostDatastore",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the host where the VM(s) will be recovered.", HelpMessage = "Name of the host where the VM(s) will be recovered.",
ParameterSetName = "recoveryHostDatastoreCluster", ParameterSetName = "recoveryHostDatastoreCluster",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$recoveryHost, [string]$recoveryHost,
[Parameter( [Parameter(
HelpMessage = "Name of the resource pool where the VM(s) will be recovered.", HelpMessage = "Name of the resource pool where the VM(s) will be recovered.",
ParameterSetName = "recoveryResourcePoolDatastore", ParameterSetName = "recoveryResourcePoolDatastore",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the resource pool where the VM(s) will be recovered.", HelpMessage = "Name of the resource pool where the VM(s) will be recovered.",
ParameterSetName = "recoveryResourcePoolDatastoreCluster", ParameterSetName = "recoveryResourcePoolDatastoreCluster",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$recoveryResourcePool, [string]$recoveryResourcePool,
[Parameter( [Parameter(
HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.",
ParameterSetName = "recoveryClusterDatastore", ParameterSetName = "recoveryClusterDatastore",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.",
ParameterSetName = "recoveryHostDatastore", ParameterSetName = "recoveryHostDatastore",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.",
ParameterSetName = "recoveryResourcePoolDatastore", ParameterSetName = "recoveryResourcePoolDatastore",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$datastore, [string]$datastore,
[Parameter( [Parameter(
HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.",
ParameterSetName = "recoveryClusterDatastoreCluster", ParameterSetName = "recoveryClusterDatastoreCluster",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.",
ParameterSetName = "recoveryHostDatastoreCluster", ParameterSetName = "recoveryHostDatastoreCluster",
Mandatory = $true Mandatory
)] )]
[Parameter( [Parameter(
HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.",
ParameterSetName = "recoveryResourcePoolDatastoreCluster", ParameterSetName = "recoveryResourcePoolDatastoreCluster",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$datastoreCluster, [string]$datastoreCluster,
[Parameter( [Parameter(
HelpMessage = "Name of folder at recovery location where the recovered virtual machine(s) will be created.", HelpMessage = "Name of folder at recovery location where the recovered virtual machine(s) will be created.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$recoveryFolder, [string]$recoveryFolder,
@@ -132,13 +132,13 @@ function New-ZertoVpg {
[String]$zorg, [String]$zorg,
[Parameter( [Parameter(
HelpMessage = "Name of the network to use during a Failover Live \ Move VPG operation.", HelpMessage = "Name of the network to use during a Failover Live \ Move VPG operation.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[String]$recoveryNetwork, [String]$recoveryNetwork,
[Parameter( [Parameter(
HelpMessage = "Name of the network to use during a Failover Test operation", HelpMessage = "Name of the network to use during a Failover Test operation",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$testNetwork, [string]$testNetwork,
@@ -5,7 +5,7 @@ function New-ZertoVpgSettingsIdentifier {
[Parameter( [Parameter(
HelpMessage = "Identifier of the VPG to create a VPG settings identifier. If a vpgIdentifier is not provided, a new VPG settings object is created without any configured settings. This would be used for creating a new VPG from scratch.", HelpMessage = "Identifier of the VPG to create a VPG settings identifier. If a vpgIdentifier is not provided, a new VPG settings object is created without any configured settings. This would be used for creating a new VPG from scratch.",
ParameterSetName = "existingVpg", ParameterSetName = "existingVpg",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true ValueFromPipelineByPropertyName = $true
)] )]
@@ -15,7 +15,7 @@ function New-ZertoVpgSettingsIdentifier {
[Parameter( [Parameter(
HelpMessage = "Use this switch when creating a vpgSettingsIdentifier for a new VPG", HelpMessage = "Use this switch when creating a vpgSettingsIdentifier for a new VPG",
ParameterSetName = "newVpg", ParameterSetName = "newVpg",
Mandatory = $true Mandatory
)] )]
[switch]$newVpg [switch]$newVpg
) )
@@ -10,7 +10,7 @@ function Remove-ZertoPeerSite {
ParameterSetName = "siteIdentifier", ParameterSetName = "siteIdentifier",
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("siteId")] [Alias("siteId")]
@@ -20,7 +20,7 @@ function Remove-ZertoPeerSite {
ParameterSetName = "peerSiteName", ParameterSetName = "peerSiteName",
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$peerSiteName, [string[]]$peerSiteName,
@@ -29,9 +29,9 @@ function Remove-ZertoPeerSite {
ParameterSetName = "hostName", ParameterSetName = "hostName",
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
Mandatory = $true Mandatory
)] )]
[ValidateScript( {$_ -match [IPAddress]$_ })] [ValidateScript( { $_ -match [IPAddress]$_ })]
[string[]]$hostName, [string[]]$hostName,
[Parameter( [Parameter(
HelpMessage = "Specify this switch to Keep the target replica disks for any VPGs replicating between the sites as the VPGs will be deleted by unpairing the sites. If this switch is not used, the target replica disks will be deleted" HelpMessage = "Specify this switch to Keep the target replica disks for any VPGs replicating between the sites as the VPGs will be deleted by unpairing the sites. If this switch is not used, the target replica disks will be deleted"
@@ -41,7 +41,7 @@ function Remove-ZertoPeerSite {
begin { begin {
$baseUri = "peersites" $baseUri = "peersites"
$body = @{} $body = @{ }
if ( $keepTargetDisks ) { if ( $keepTargetDisks ) {
$body['IsKeepTargetDisks'] = $true $body['IsKeepTargetDisks'] = $true
} else { } else {
@@ -78,4 +78,4 @@ function Remove-ZertoPeerSite {
end { end {
# Nothing to do # Nothing to do
} }
} }
+3 -3
View File
@@ -3,7 +3,7 @@ function Remove-ZertoVpg {
[cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "vpgIdentifier" )] [cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "vpgIdentifier" )]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
ParameterSetName = "vpgName", ParameterSetName = "vpgName",
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
@@ -12,7 +12,7 @@ function Remove-ZertoVpg {
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
ParameterSetName = "vpgIdentifier", ParameterSetName = "vpgIdentifier",
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
@@ -33,7 +33,7 @@ function Remove-ZertoVpg {
begin { begin {
$baseUri = "vpgs" $baseUri = "vpgs"
$body = @{} $body = @{ }
if ($keepRecoveryVolumes) { if ($keepRecoveryVolumes) {
$body['KeepRecoveryVolumes'] = $True $body['KeepRecoveryVolumes'] = $True
} else { } else {
+1 -1
View File
@@ -4,7 +4,7 @@ function Resume-ZertoVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of VPG(s) to resume replication", HelpMessage = "Name(s) of VPG(s) to resume replication",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
@@ -6,7 +6,7 @@ function Save-ZertoVpgSetting {
param( param(
[Parameter( [Parameter(
HelpMessage = "VpgSettings Identifier to save", HelpMessage = "VpgSettings Identifier to save",
Mandatory = $true, Mandatory,
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true ValueFromPipelineByPropertyName = $true
)] )]
@@ -15,8 +15,16 @@ function Save-ZertoVpgSetting {
[string]$vpgSettingsIdentifier [string]$vpgSettingsIdentifier
) )
$baseUri = "vpgsettings/{0}/commit" -f $vpgSettingsIdentifier Begin {
if ($PSCmdlet.ShouldProcess("Commiting VPG Settings with Settigns identifier $vpgSettingsIdentifier")) { }
Invoke-ZertoRestRequest -uri $baseUri -method "POST"
Process {
$baseUri = "vpgsettings/{0}/commit" -f $vpgSettingsIdentifier
if ($PSCmdlet.ShouldProcess("Commiting VPG Settings with Settigns identifier $vpgSettingsIdentifier")) {
Invoke-ZertoRestRequest -uri $baseUri -method "POST"
}
}
End {
} }
} }
+3 -3
View File
@@ -5,7 +5,7 @@ function Set-ZertoAlert {
[Parameter( [Parameter(
ValueFromPipeline = $true, ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
Mandatory = $true, Mandatory,
HelpMessage = "Alert identifier(s) to be dismissed or undismissed." HelpMessage = "Alert identifier(s) to be dismissed or undismissed."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -13,13 +13,13 @@ function Set-ZertoAlert {
[string[]]$alertId, [string[]]$alertId,
[Parameter( [Parameter(
ParameterSetName = "dismiss", ParameterSetName = "dismiss",
Mandatory = $true, Mandatory,
HelpMessage = "Will dismiss the selected alert." HelpMessage = "Will dismiss the selected alert."
)] )]
[switch]$dismiss, [switch]$dismiss,
[Parameter( [Parameter(
ParameterSetName = "undismiss", ParameterSetName = "undismiss",
Mandatory = $true, Mandatory,
HelpMessage = "Will undismiss the selected alert." HelpMessage = "Will undismiss the selected alert."
)] )]
[switch]$undismiss [switch]$undismiss
+3 -3
View File
@@ -3,7 +3,7 @@ function Set-ZertoLicense {
[cmdletbinding( SupportsShouldProcess = $true )] [cmdletbinding( SupportsShouldProcess = $true )]
param ( param (
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "License Key to apply to the Zerto Virtual Manager" HelpMessage = "License Key to apply to the Zerto Virtual Manager"
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
@@ -12,7 +12,7 @@ function Set-ZertoLicense {
begin { begin {
$baseUri = "license" $baseUri = "license"
$body = @{"LicenseKey" = $licenseKey} $body = @{"LicenseKey" = $licenseKey }
} }
process { process {
@@ -24,4 +24,4 @@ function Set-ZertoLicense {
end { end {
# Nothing to do # Nothing to do
} }
} }
@@ -4,7 +4,7 @@ function Start-ZertoCloneVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name of the VPG you wish to clone.", HelpMessage = "Name of the VPG you wish to clone.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$vpgName, [string]$vpgName,
@@ -36,7 +36,7 @@ function Start-ZertoCloneVpg {
if ( $PSBoundParameters.ContainsKey('datastoreName') ) { if ( $PSBoundParameters.ContainsKey('datastoreName') ) {
$recoverysiteIdentifier = $vpgInfo.recoverysite.identifier $recoverysiteIdentifier = $vpgInfo.recoverysite.identifier
$recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores $recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores
$datastoreIdentifier = $($recoverySiteDatastores | Where-Object {$_.datastoreName -like $datastoreName}).DatastoreIdentifier $datastoreIdentifier = $($recoverySiteDatastores | Where-Object { $_.datastoreName -like $datastoreName }).DatastoreIdentifier
if ( -not $datastoreIdentifier ) { if ( -not $datastoreIdentifier ) {
Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop
} }
@@ -45,7 +45,7 @@ function Start-ZertoCloneVpg {
$vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName
[System.Collections.ArrayList]$vmIdentifiers = @() [System.Collections.ArrayList]$vmIdentifiers = @()
foreach ( $name in $vmName ) { foreach ( $name in $vmName ) {
$selectedVm = $vpgVmInformation | Where-Object {$_.VmName.toLower() -eq $name.toLower()} $selectedVm = $vpgVmInformation | Where-Object { $_.VmName.toLower() -eq $name.toLower() }
if ($null -eq $selectedVm) { if ($null -eq $selectedVm) {
Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop
} elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) {
@@ -63,7 +63,7 @@ function Start-ZertoCloneVpg {
process { process {
$uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier $uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier
$body = [ordered]@{} $body = [ordered]@{ }
if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) { if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) {
$body['checkpointId'] = $checkpointIdentifier $body['checkpointId'] = $checkpointIdentifier
} }
@@ -4,7 +4,7 @@ function Start-ZertoFailoverTest {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name of VPG to failover test", HelpMessage = "Name of VPG to failover test",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$vpgName, [string]$vpgName,
@@ -4,7 +4,7 @@ function Stop-ZertoCloneVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name of the VPG to stop cloning", HelpMessage = "Name of the VPG to stop cloning",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$vpgName [string]$vpgName
@@ -4,7 +4,7 @@ function Stop-ZertoFailoverTest {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of VPG(s) to stop testing.", HelpMessage = "Name(s) of VPG(s) to stop testing.",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName, [string[]]$vpgName,
@@ -21,7 +21,7 @@ function Stop-ZertoFailoverTest {
begin { begin {
$baseUri = "vpgs" $baseUri = "vpgs"
$body = @{"FailoverTestSuccess" = $failoverTestSuccess; "FailoverTestSummary" = $failoverTestSummary} $body = @{"FailoverTestSuccess" = $failoverTestSuccess; "FailoverTestSummary" = $failoverTestSummary }
} }
process { process {
+1 -1
View File
@@ -4,7 +4,7 @@ function Suspend-ZertoVpg {
param( param(
[Parameter( [Parameter(
HelpMessage = "Name(s) of VPG(s) to pause replication", HelpMessage = "Name(s) of VPG(s) to pause replication",
Mandatory = $true Mandatory
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string[]]$vpgName [string[]]$vpgName
@@ -3,7 +3,7 @@ function Uninstall-ZertoVra {
[cmdletbinding()] [cmdletbinding()]
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory,
HelpMessage = "Host Name attached to the VRA to be removed." HelpMessage = "Host Name attached to the VRA to be removed."
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
+7 -7
View File
@@ -19,7 +19,7 @@ Get-ZertoEvent [<CommonParameters>]
### filter ### filter
``` ```
Get-ZertoEvent [-startDate <String>] [-endDate <String>] [-vpg <String>] [-vpgIdentifier <String>] Get-ZertoEvent [-startDate <String>] [-endDate <String>] [-vpgName <String>] [-vpgIdentifier <String>]
[-eventType <String>] [-siteName <String>] [-siteIdentifier <String>] [-zorgIdentifier <String>] [-eventType <String>] [-siteName <String>] [-siteIdentifier <String>] [-zorgIdentifier <String>]
[-entityType <String>] [-userName <String>] [-category <String>] [-eventCategory <String>] [-entityType <String>] [-userName <String>] [-category <String>] [-eventCategory <String>]
[-alertIdentifier <String>] [<CommonParameters>] [-alertIdentifier <String>] [<CommonParameters>]
@@ -292,13 +292,13 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -vpg ### -vpgIdentifier
The name of the VPG for which you want to return events. The identifier of the VPG for which you want to return events.
```yaml ```yaml
Type: String Type: String
Parameter Sets: filter Parameter Sets: filter
Aliases: vpgName Aliases: vpgId
Required: False Required: False
Position: Named Position: Named
@@ -307,13 +307,13 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -vpgIdentifier ### -vpgName
The identifier of the VPG for which you want to return events. The name of the VPG for which you want to return events.
```yaml ```yaml
Type: String Type: String
Parameter Sets: filter Parameter Sets: filter
Aliases: vpgId Aliases: vpg
Required: False Required: False
Position: Named Position: Named