Compare commits
101 Commits
1.4.2
...
AzureVpg_v2
| Author | SHA1 | Date | |
|---|---|---|---|
| e16d4d8105 | |||
| 50e03b36f5 | |||
| 4531d2d53b | |||
| e6e6be9ede | |||
| 5c2dd620d8 | |||
| 143d5f801e | |||
| a5a91febcf | |||
| bb5dbaa0d4 | |||
| e6b5777e64 | |||
| f46c620302 | |||
| 3c60b0c0f3 | |||
| d832812c13 | |||
| 80e0db3883 | |||
| 809f9af60d | |||
| 5a9cba00d5 | |||
| 549238a22d | |||
| 253c9ba1b9 | |||
| 794f87dbf8 | |||
| ca45adcd5d | |||
| 5a3f2d8eec | |||
| ddee165575 | |||
| f0279633dd | |||
| 139e52f3e2 | |||
| eea6e95988 | |||
| 0630cbb20e | |||
| 682750fc6d | |||
| 9dc9aa92d0 | |||
| 23e0b8a665 | |||
| ae53dcd4d2 | |||
| ced5671ab2 | |||
| cb528df3d4 | |||
| c91d53ecad | |||
| 8d8cb58558 | |||
| 2dad347544 | |||
| 6f798fd96a | |||
| 649e7413a7 | |||
| af6e81267b | |||
| b6d8083b69 | |||
| 9d4b4d3533 | |||
| 510f0b9ed7 | |||
| 9561936be7 | |||
| 961eafb945 | |||
| aa73534d7f | |||
| 56bbe59ea7 | |||
| 5f786775dc | |||
| 14ef5048e4 | |||
| d7e46bd263 | |||
| c64c82f8bc | |||
| a59feb2d5f | |||
| d9e1063654 | |||
| d9e6c74f27 | |||
| df82bc26ca | |||
| dbde9aa4c2 | |||
| 7dcb6539a5 | |||
| 3621ddef8d | |||
| 5b4a25b66d | |||
| 5a2c01341c | |||
| c477d40364 | |||
| 494c45b02c | |||
| 8318229cf4 | |||
| 7427ffe707 | |||
| 713c94461c | |||
| 0872f1a655 | |||
| a072905253 | |||
| 41fddf5f13 | |||
| 136d1b2c76 | |||
| a25bf3adfe | |||
| 93c55bdd07 | |||
| 5627992a04 | |||
| 7fc7edff86 | |||
| 6f1e582ceb | |||
| 0f1b4302bb | |||
| ea8d6f096d | |||
| ddae22fb9f | |||
| 6903ccc99b | |||
| 7ce6369ad7 | |||
| 2d453ef608 | |||
| 363b6e727c | |||
| f4c1cf630a | |||
| 348fcbd28c | |||
| 3000a2b013 | |||
| 52609bf64a | |||
| e021a7bab0 | |||
| c3ad8dd415 | |||
| f81a22ca80 | |||
| de1a85cecd | |||
| d3acba3967 | |||
| 512d5bbd74 | |||
| 9ad9cb7f1e | |||
| a55b0cd467 | |||
| aab22cf266 | |||
| 906d35186f | |||
| c7c3428dd5 | |||
| e90d2a23cc | |||
| 925ecaf224 | |||
| 32403ec3e3 | |||
| 73540faeb9 | |||
| 932262e33a | |||
| 1e84f5aea0 | |||
| 7befc7d21e | |||
| cdad0c5e79 |
@@ -6,3 +6,4 @@ SourceTestResults.xml
|
||||
publish/*
|
||||
CodeCoverage.xml
|
||||
scratch
|
||||
.DS_Store
|
||||
|
||||
Vendored
+2
-1
@@ -4,5 +4,6 @@
|
||||
"editor.insertSpaces": true,
|
||||
"editor.tabSize": 4,
|
||||
"powershell.codeFormatting.preset": "OTBS",
|
||||
"terminal.integrated.shell.windows": "c:/Program Files/PowerShell/7/pwsh.exe"
|
||||
"terminal.integrated.shell.windows": "c:/Program Files/PowerShell/7/pwsh.exe",
|
||||
"powershell.codeFormatting.addWhitespaceAroundPipe": true
|
||||
}
|
||||
|
||||
@@ -5,6 +5,50 @@ 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
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### New
|
||||
|
||||
* Added `Get-ZertoAzureResource` function to the module. This function is designed to retrieve information about resources in Azure that can be utilized when creating VPGs targeting the specified Azure site. Please read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoAzureResource.md) for more information and examples.
|
||||
## [1.5.1]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/108) with `New-ZertoVpg` where when specifying a single host as a recovery target, the host identifier was not properly assigned. - Thanks @jonsouzerto!
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/86) with `Invoke-ZertoMoveVpg` where parameters should have been mandatory in certain workflows. - Thanks @gdbarron!
|
||||
|
||||
## [1.5.0]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### New
|
||||
|
||||
* Added `Add-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md) for more information.
|
||||
* Added `Remove-ZertoVpgVm` function to the module. Read the [help file](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Remove-ZertoVpgVm.md) for more information.
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/103) with `Add-ZertoPeerSite` where there was an incorrect settings validator on the `-targetHost` parameter where it would not accept a hostname.
|
||||
|
||||
## [1.4.3]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
#### Updated
|
||||
|
||||
* Updated `Connect-ZertoServer` with a `-AutoReconnect` switch to allow the auto reconnection of a session that has timed-out.
|
||||
* Updated `New-ZertoVpg` to have a Default Parameter Set of `recoveryHostDatastore` should no parameters be passed when calling the function.
|
||||
* Updated `New-ZertoVpg -recoverySite` parameter to be case-insensitive
|
||||
|
||||
#### Fixed
|
||||
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/96) with `Set-ZertoLicense` so that ShouldProcess functions properly.
|
||||
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/95) when attempting to connect to an unlicensed site.
|
||||
|
||||
## [1.4.2]
|
||||
|
||||
### Zerto Virtual Manager
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#Requires -Modules Pester
|
||||
$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' {
|
||||
BeforeAll {
|
||||
@@ -14,7 +14,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'targetHost'; Type = 'String'; Mandatory = $true; Validation = 'Script' }
|
||||
@{ParameterName = 'targetHost'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'targetPort'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'token'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
@@ -27,11 +27,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'Script' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
'Range' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
|
||||
@@ -63,8 +58,8 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 16 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 16
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgSettingsIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add-ZertoPeerSite::Functional Unit Tests" {
|
||||
}
|
||||
}
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -1,6 +1,6 @@
|
||||
#Requires -Modules Pester
|
||||
$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' {
|
||||
BeforeAll {
|
||||
@@ -45,6 +45,16 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
{ Connect-ZertoServer -zertoServer -credential 1234 } | Should -Throw
|
||||
{ Connect-ZertoServer -zertoServer -credential $(@{Username = "zerto\build"; Password = 'SecureString' }) } | Should -Throw
|
||||
}
|
||||
|
||||
It "has a switch parameter to return the headers" {
|
||||
Get-Command $global:function | Should -HaveParameter returnHeaders
|
||||
Get-Command $global:function | Should -HaveParameter returnHeaders -Type Switch
|
||||
}
|
||||
|
||||
It "has a switch parameter to auto reauthorize the session" {
|
||||
Get-Command $global:function | Should -HaveParameter autoReconnect
|
||||
Get-Command $global:function | Should -HaveParameter autoReconnect -Type Switch
|
||||
}
|
||||
}
|
||||
|
||||
InModuleScope -ModuleName ZertoApiWrapper {
|
||||
@@ -57,10 +67,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
return $results
|
||||
}
|
||||
|
||||
Mock -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite {
|
||||
return (Get-Content -Path "$global:here\Mocks\LocalSiteInfo.json" -Raw | ConvertFrom-Json)
|
||||
}
|
||||
|
||||
Context "$($global:function)::InModuleScope Function Unit Tests" {
|
||||
|
||||
BeforeAll {
|
||||
@@ -96,12 +102,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
$script:zvmHeaders['Accept'] | Should -BeOfType String
|
||||
}
|
||||
|
||||
It "Module Scope zvmLocalInfo variable tests" {
|
||||
$script:zvmLocalInfo | Should -Not -BeNullOrEmpty
|
||||
$script:zvmLocalInfo | Should -BeOfType PSCustomObject
|
||||
$script:zvmLocalInfo.SiteIdentifier | Should -BeOfType String
|
||||
}
|
||||
|
||||
$headers = Connect-ZertoServer -zertoServer $Server -credential $credential -returnHeaders
|
||||
It "returns a Hashtable with 2 keys" {
|
||||
$headers | Should -BeOfType Hashtable
|
||||
@@ -134,7 +134,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
}
|
||||
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 4
|
||||
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Get-ZertoLocalSite -Exactly 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 17 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 17
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'siteName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'SiteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'SecurityGroup'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
|
||||
@{ParameterName = 'Subnet'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
|
||||
@{ParameterName = 'Network'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
|
||||
@{ParameterName = 'VmInstanceType'; Type = 'Switch'; Mandatory = $true; Validation = 'None' }
|
||||
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'None' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Count | Should -Be 3
|
||||
}
|
||||
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "$global:function::Functional Unit Tests" {
|
||||
|
||||
}
|
||||
}
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -5,17 +5,18 @@ $global:function = ((Split-Path -leaf $PSCommandPath).Split('.'))[0]
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
It "$global:function should have exactly 20 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 20
|
||||
It "$global:function should have exactly 21 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 21
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'vpgIdentifier'; Type = 'Guid[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'vpgName'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'commitPolicy'; Type = 'String'; Mandatory = $false; Validation = 'Set' }
|
||||
@{ParameterName = 'commitPolicyTimeout'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
|
||||
@{ParameterName = 'forceShutdown'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $true; Validation = $null }
|
||||
@{ParameterName = 'disableReverseProtection'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'keepSourceVms'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'ContinueOnPreScriptFailure'; Type = 'Switch'; Mandatory = $false; Validation = $null }
|
||||
@{ParameterName = 'whatIf'; Type = 'Switch'; Mandatory = $false; Validation = 'ShouldProcess' }
|
||||
)
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
#Requires -Modules Pester
|
||||
$global:here = (Split-Path -Parent $PSCommandPath)
|
||||
$global:function = ((Split-Path -Leaf $PSCommandPath).Split('.'))[0]
|
||||
|
||||
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
|
||||
BeforeAll {
|
||||
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
|
||||
}
|
||||
|
||||
Context "$global:function::Parameter Unit Tests" {
|
||||
|
||||
It "$global:function should have exactly 15 parameters defined" {
|
||||
(Get-Command $global:function).Parameters.Count | Should -Be 15
|
||||
}
|
||||
|
||||
$ParameterTestCases = @(
|
||||
@{ParameterName = 'Vm'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
@{ParameterName = 'VpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
|
||||
)
|
||||
|
||||
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Type, $Mandatory, $Validation)
|
||||
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
|
||||
}
|
||||
|
||||
It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
|
||||
param($ParameterName, $Validation)
|
||||
Switch ($Validation) {
|
||||
'NotNullOrEmpty' {
|
||||
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
|
||||
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
|
||||
}
|
||||
|
||||
default {
|
||||
$true | Should -Be $false -Because "No Validation Selected. Review test cases"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
It "Supports 'SupportsShouldProcess'" {
|
||||
Get-Command $global:function | Should -HaveParameter WhatIf
|
||||
Get-Command $global:function | Should -HaveParameter Confirm
|
||||
$script:ScriptBlock | Should -Match 'SupportsShouldProcess'
|
||||
$script:ScriptBlock | Should -Match '\$PSCmdlet\.ShouldProcess\(.+\)'
|
||||
}
|
||||
}
|
||||
|
||||
Context "Add-ZertoPeerSite::Functional Unit Tests" {
|
||||
}
|
||||
}
|
||||
Remove-Variable -Name here -Scope Global
|
||||
Remove-Variable -Name function -Scope Global
|
||||
@@ -7,7 +7,7 @@
|
||||
SkipPublisherCheck = $true
|
||||
}
|
||||
Target = 'CurrentUser'
|
||||
Version = '5.5.11'
|
||||
Version = '5.6.0'
|
||||
Tags = 'Bootstrap'
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
SkipPublisherCheck = $true
|
||||
}
|
||||
Target = 'CurrentUser'
|
||||
Version = '1.18.3'
|
||||
Version = '1.19.0'
|
||||
Tags = 'Bootstrap'
|
||||
}
|
||||
|
||||
|
||||
+44
-43
@@ -1,23 +1,24 @@
|
||||
#Requires -Modules 'InvokeBuild'
|
||||
|
||||
$version = "{0}" -f $(Get-Content .\version.txt)
|
||||
$moduleOutPath = "{0}\publish\ZertoApiWrapper" -f $BuildRoot
|
||||
|
||||
#Define the default task
|
||||
task . CreateArtifacts
|
||||
task . build
|
||||
|
||||
#Region - Helper Functions
|
||||
function ImportSourceModule() {
|
||||
function ImportSourceModule {
|
||||
If (Get-Module -Name ZertoApiWrapper) {
|
||||
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
|
||||
}
|
||||
Import-Module "$BuildRoot\ZertoApiWrapper\ZertoApiWrapper.psd1" -ErrorAction Stop
|
||||
}
|
||||
|
||||
function ImportBuiltModule() {
|
||||
function ImportBuiltModule {
|
||||
If (Get-Module -Name ZertoApiWrapper) {
|
||||
Remove-Module -Name ZertoApiWrapper -Force -ErrorAction Stop
|
||||
}
|
||||
Import-Module "$BuildRoot\temp\ZertoApiWrapper.psd1" -ErrorAction Stop
|
||||
Import-Module ("{0}\ZertoApiWrapper.psd1" -f $moduleOutPath) -ErrorAction Stop
|
||||
}
|
||||
#EndRegion
|
||||
|
||||
@@ -65,7 +66,7 @@ task AnalyzeSourceFiles CheckPSScriptAnalyzerInstalled, {
|
||||
|
||||
task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
|
||||
$scriptAnalyzerParams = @{
|
||||
Path = "$BuildRoot\temp\"
|
||||
Path = $moduleOutPath
|
||||
Severity = @('Error', 'Warning')
|
||||
Recurse = $true
|
||||
Verbose = $false
|
||||
@@ -81,17 +82,13 @@ task AnalyzeBuiltFiles CheckPSScriptAnalyzerInstalled, CreatePsm1ForRelease, {
|
||||
#EndRegion
|
||||
|
||||
#Region - Clean Operations
|
||||
task CleanTemp {
|
||||
if (-not $(Test-Path "$BuildRoot\temp")) {
|
||||
New-Item -Path $BuildRoot -Name "temp" -ItemType "Directory"
|
||||
}
|
||||
Remove-Item -Recurse -Path "$BuildRoot\temp\*"
|
||||
}
|
||||
|
||||
task CleanPublish {
|
||||
if ($(Test-Path "$BuildRoot\publish")) {
|
||||
Remove-Item -Recurse -Path "$BuildRoot\publish\*"
|
||||
} else {
|
||||
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
|
||||
}
|
||||
New-Item -Path $moduleOutPath -ItemType "Directory"
|
||||
}
|
||||
#EndRegion
|
||||
|
||||
@@ -107,7 +104,7 @@ task SourceFileTests CheckPesterInstalled, {
|
||||
task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
|
||||
ImportBuiltModule
|
||||
$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 Failed
|
||||
$FailureMessage = '{0} Unit test(s) failed. Aborting build' -f $results.FailedCount
|
||||
Assert ($results.FailedCount -eq 0) $FailureMessage
|
||||
}
|
||||
@@ -116,7 +113,7 @@ task BuiltFileTests CreatePsm1ForRelease, CheckPesterInstalled, {
|
||||
#Region - Build Help System
|
||||
$buildMamlParams = @{
|
||||
Inputs = { Get-ChildItem docs\*.md }
|
||||
Outputs = "$BuildRoot\temp\en-us\ZertoApiWrapper-help.xml"
|
||||
Outputs = "{0}\en-us\ZertoApiWrapper-help.xml" -f $moduleOutPath
|
||||
}
|
||||
|
||||
task BuildMamlHelp CheckPlatyPSInstalled, {
|
||||
@@ -126,19 +123,19 @@ task BuildMamlHelp CheckPlatyPSInstalled, {
|
||||
platyPS\New-ExternalHelp .\docs -Force -OutputPath $buildMamlParams.Outputs
|
||||
}
|
||||
|
||||
task UpdateMarkdownHelp CheckPlatyPSInstalled, {
|
||||
ImportSourceModule
|
||||
task UpdateMarkdownHelp quickBuild, CheckPlatyPSInstalled, {
|
||||
ImportBuiltModule
|
||||
Update-MarkdownHelpModule -Path docs -AlphabeticParamsOrder
|
||||
}
|
||||
#EndRegion
|
||||
|
||||
#Region - Build Module Files
|
||||
task CreatePsd1ForRelease CleanTemp, {
|
||||
task CreatePsd1ForRelease CleanPublish, {
|
||||
$functionsToExport = Get-ChildItem -Path 'ZertoApiWrapper\Public\*.ps1' | ForEach-Object { $_.BaseName }
|
||||
$releaseNotes = "Please review the [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/{0}) on GitHub." -f $version
|
||||
|
||||
$ManifestParams = @{
|
||||
Path = "$BuildRoot\temp\ZertoApiWrapper.psd1"
|
||||
Path = "{0}\ZertoApiWrapper.psd1" -f $moduleOutPath
|
||||
RootModule = 'ZertoApiWrapper.psm1'
|
||||
ModuleVersion = $version
|
||||
GUID = '4c0b9e17-141b-4dd5-8549-fb21cccaa325'
|
||||
@@ -161,43 +158,47 @@ task CreatePsd1ForRelease CleanTemp, {
|
||||
|
||||
task CreatePsm1ForRelease CreatePsd1ForRelease, {
|
||||
$emptyLine = ""
|
||||
$psm1Path = "$BuildRoot\temp\ZertoApiWrapper.psm1"
|
||||
$psm1Path = "{0}\ZertoApiWrapper.psm1" -f $moduleOutPath
|
||||
$lines = '#------------------------------------------------------------#'
|
||||
$Private = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Private\*.ps1 -ErrorAction Stop )
|
||||
$Public = @( Get-ChildItem -Path $BuildRoot\ZertoApiWrapper\Public\*.ps1 -ErrorAction Stop )
|
||||
Add-Content -Path $psm1Path -Value $lines
|
||||
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#"
|
||||
Add-Content -Path $psm1Path -Value $lines
|
||||
Add-Content -Path $psm1Path -Value $emptyLine
|
||||
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value "#---------------------Private Functions----------------------#" -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||
foreach ($file in $private) {
|
||||
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw)
|
||||
Add-Content -Path $psm1Path -Value $emptyLine
|
||||
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||
}
|
||||
Add-Content -Path $psm1Path -Value $lines
|
||||
Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#"
|
||||
Add-Content -Path $psm1Path -Value $lines
|
||||
Add-Content -Path $psm1Path -Value $emptyLine
|
||||
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value "#----------------------Public Functions----------------------#" -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value $lines -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||
foreach ($file in $public) {
|
||||
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw)
|
||||
Add-Content -Path $psm1Path -Value $emptyLine
|
||||
Add-Content -Path $psm1Path -Value $(Get-Content -Path $file.Fullname -Raw) -Encoding 'utf8'
|
||||
Add-Content -Path $psm1Path -Value $emptyLine -Encoding 'utf8'
|
||||
}
|
||||
# Add-Content -Path $psm1Path -Value $emptyLine
|
||||
# Add-Content -Path $psm1Path -Value "Export-ModuleMember -Function $exportString"
|
||||
}
|
||||
#EndRegion
|
||||
|
||||
#Region - Artifacts \ Publish
|
||||
# Full Build Process - No Publishing
|
||||
task CreateArtifacts CleanPublish, CleanTemp, AnalyzeSourceFiles, SourceFileTests, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
|
||||
if (-not $(Test-Path "$BuildRoot\publish")) {
|
||||
New-Item -Path $BuildRoot -Name "publish" -ItemType Directory
|
||||
task CreateArtifacts CleanPublish, AnalyzeBuiltFiles, BuiltFileTests, BuildMamlHelp, {
|
||||
Compress-Archive -Path $moduleOutPath -DestinationPath .\publish\ZertoApiWrapper.zip
|
||||
$MyMatches = Select-String -Path "$BuildRoot\CHANGELOG.md" "^##\s\["
|
||||
$data = Get-Content "$BuildRoot\CHANGELOG.md"
|
||||
$range = ($MyMatches[0].LineNumber - 1)..($MyMatches[1].LineNumber - 3)
|
||||
foreach ($i in $range) {
|
||||
Add-Content -Path "$BuildRoot\publish\ReleaseNotes.md" -Value ($data[$i]).replace("## ", "# ") -Encoding utf8
|
||||
}
|
||||
Compress-Archive -Path .\temp\* -DestinationPath .\publish\ZertoApiWrapper.zip
|
||||
#ImportBuiltModule
|
||||
#(Get-Module ZertoApiWrapper).ReleaseNotes | Add-Content .\publish\release-notes.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.Depend.psd1" "$BuildRoot\publish\ZertoApiWrapper.Depend.psd1"
|
||||
Copy-Item "$BuildRoot\build.ps1" "$BuildRoot\publish\build.ps1"
|
||||
}
|
||||
#EndRegion
|
||||
|
||||
task build CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, BuiltFileTests, CreateArtifacts
|
||||
task quickBuild CleanPublish, CreatePsm1ForRelease, AnalyzeBuiltFiles, {
|
||||
Get-Module -Name ZertoApiWrapper | Remove-Module -Force
|
||||
ImportBuiltModule
|
||||
}
|
||||
task release build, {
|
||||
Publish-Module -Path $moduleOutPath -NuGetApiKey "1234" -WhatIf
|
||||
}
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Add-ZertoAzureVpgVm {
|
||||
[Cmdletbinding()]
|
||||
param(
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "VPG Settings Identifier of the target VPG.",
|
||||
ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Guid]$VpgSettingsIdentifier,
|
||||
[Parameter(Mandatory)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$VmName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveNetworkName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveSubnetName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveSecurityGroupName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveInstanceType,
|
||||
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
|
||||
[String]$LiveDiskType,
|
||||
[ValidateScript( { $_ -match [IPAddress]$_ })]
|
||||
[String]$LiveIpAddress,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestNetworkName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestSubnetName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestSecurityGroupName,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestInstanceType,
|
||||
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
|
||||
[String]$TestDiskType,
|
||||
[ValidateScript( { $_ -match [IPAddress]$_ })]
|
||||
[String]$TestIpAddress,
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String[]]$TempDrive
|
||||
)
|
||||
|
||||
begin {
|
||||
}
|
||||
|
||||
process {
|
||||
# Get Target Site Identifier from the settings for resource lookups
|
||||
$TargetSiteIdentifier = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier -basic | Select-Object -ExpandProperty RecoverySiteIdentifier
|
||||
|
||||
# Add VM to VPG. Setting to Null as this function returns the VpgSettingsIdentifier
|
||||
$null = Add-ZertoVpgVm -vpgSettingsIdentifier $VpgSettingsIdentifier -vm $VmName
|
||||
|
||||
# Getting the VmIdentifier
|
||||
$VmIdentifier = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier -vms | Where-Object { $_.VmName -match $VmName } | Select-Object -ExpandProperty VmIdentifier
|
||||
|
||||
# Setting the URI fragment for use later
|
||||
$VmSettingsUri = "vpgSettings/{0}/vms/{1}" -f $VpgSettingsIdentifier, $VmIdentifier
|
||||
|
||||
# Getting all default settings for the specified VM to update per passed parameters
|
||||
$VmSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier -vmIdentifier $VmIdentifier
|
||||
|
||||
# Create Maps for quick lookups and validations
|
||||
$NetworksMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Network) -Key "VirtualNetworkName" -Value "VirtualNetworkIdentifier"
|
||||
$SubnetsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Subnet) -Key "SubnetName" -Value "SubnetIdentifier"
|
||||
$SecurityGroupsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -SecurityGroup) -Key "SecurityGroupName" -Value "SecurityGroupIdentifier"
|
||||
$Instances = Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -VmInstanceType
|
||||
|
||||
# Iterate through the bound parameters and set attributes accordingly
|
||||
Switch ($PSBoundParameters.Keys) {
|
||||
"LiveNetworkName" {
|
||||
if ($null -eq $NetworksMap[$LiveNetworkName]) {
|
||||
Write-Error "Unable to find network with name $LiveNetworkName. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$VmSettings.Recovery.PublicCloud.Failover.VirtualNetworkIdentifier = $NetworksMap[$LiveNetworkName]
|
||||
}
|
||||
}
|
||||
|
||||
"LiveSubnetName" {
|
||||
if ($null -eq $SubnetsMap[$LiveSubnetName]) {
|
||||
Write-Error "Unable to find subnet with name $LiveSubnetName. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$VmSettings.Nics[0].Failover.PublicCloud.SubnetIdentifier = $SubnetsMap[$LiveSubnetName]
|
||||
}
|
||||
}
|
||||
|
||||
"LiveSecurityGroupName" {
|
||||
if ($null -eq $null -eq $SecurityGroupsMap[$LiveSecurityGroupName]) {
|
||||
Write-Error "Unable to find security group with name $LiveSecurityGroupName. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$VmSettings.Nics[0].Failover.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$LiveSecurityGroupName]
|
||||
}
|
||||
}
|
||||
|
||||
"LiveInstanceType" {
|
||||
if ($LiveInstanceType -notin $Instances.VmInstanceType) {
|
||||
Write-Error "Unable to find a supported VM Instance Type with name $LiveInstanceType. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$LiveInstanceType = $Instances.Where( { $_.VmInstanceType -match $LiveInstanceType }) | Select-Object -ExpandProperty VmInstanceType
|
||||
$VmSettings.Recovery.PublicCloud.Failover.VmInstanceType = $LiveInstanceType
|
||||
}
|
||||
}
|
||||
|
||||
"TestNetworkName" {
|
||||
if ($null -eq $NetworksMap[$TestNetworkName]) {
|
||||
Write-Error "Unable to find network with name $TestNetworkName. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$VmSettings.Recovery.PublicCloud.FailoverTest.VirtualNetworkIdentifier = $NetworksMap[$TestNetworkName]
|
||||
}
|
||||
}
|
||||
|
||||
"TestSubnetName" {
|
||||
if ($null -eq $SubnetsMap[$TestSubnetName]) {
|
||||
Write-Error "Unable to find subnet with name $TestSubnetName. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$VmSettings.Nics[0].FailoverTest.PublicCloud.SubnetIdentifier = $SubnetsMap[$TestSubnetName]
|
||||
}
|
||||
}
|
||||
|
||||
"TestSecurityGroupName" {
|
||||
if ($null -eq $SecurityGroupsMap) {
|
||||
Write-Error "Unable to find security group with name $TestSecurityGroupName. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$VmSettings.Nics[0].FailoverTest.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$TestSecurityGroupName]
|
||||
}
|
||||
}
|
||||
|
||||
"TestInstanceType" {
|
||||
if ($TestInstanceType -notin $Instances.VmInstanceType) {
|
||||
Write-Error "Unable to find a supported VM Instance Type with name $TestInstanceType. Please check the name and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$TestInstanceType = $Instances.Where( { $_.VmInstanceType -match $TestInstanceType }) | Select-Object -ExpandProperty VmInstanceType
|
||||
$VmSettings.Recovery.PublicCloud.FailoverTest.VmInstanceType = $TestInstanceType
|
||||
}
|
||||
}
|
||||
|
||||
"LiveDiskType" {
|
||||
$VmSettings.Recovery.PublicCloud.Failover.Azure.RecoveryDiskType = $LiveDiskType
|
||||
}
|
||||
|
||||
"TestDiskType" {
|
||||
$VmSettings.Recovery.PublicCloud.FailoverTest.Azure.RecoveryDiskType = $TestDiskType
|
||||
}
|
||||
|
||||
"LiveIpAddress" {
|
||||
$VmSettings.Nics[0].Failover.PublicCloud.PrivateIP = $LiveIpAddress
|
||||
}
|
||||
|
||||
"TestIpAddress" {
|
||||
$VmSettings.Nics[0].FailoverTest.PublicCloud.PrivateIP = $TestIpAddress
|
||||
}
|
||||
} # End Switch Statement
|
||||
|
||||
# Update the VPG VM Settings Object with the updated attributes
|
||||
$null = Invoke-ZertoRestRequest -uri $VmSettingsUri -method PUT -body ($VmSettings | ConvertTo-Json -Depth 10)
|
||||
|
||||
# If any Temp Drives are specified, loop through them and set them as such
|
||||
if ($PSBoundParameters.Keys -contains "TempDrive") {
|
||||
foreach ($drive in $TempDrive) {
|
||||
$driveUri = "{0}/volumes/{1}" -f $VmSettingsUri, $drive
|
||||
$driveSettings = Invoke-ZertoRestRequest -uri $driveUri
|
||||
$driveSettings.IsSwap = $True
|
||||
$null = Invoke-ZertoRestRequest -uri $driveUri -method PUT -body ($driveSettings | ConvertTo-Json -Depth 10)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ function Add-ZertoPeerSite {
|
||||
Mandatory,
|
||||
HelpMessage = "Target Hostname or IP address to pair the localsite to."
|
||||
)]
|
||||
[ValidateScript( { $_ -match [IPAddress]$_ } )]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$targetHost,
|
||||
[Parameter(
|
||||
HelpMessage = "Target communication port. Default is 9081"
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Add-ZertoVpgVm {
|
||||
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VpgName")]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Vpg Settings Identifier",
|
||||
ValueFromPipeline,
|
||||
ValueFromPipelineByPropertyName,
|
||||
ValueFromRemainingArguments,
|
||||
ParameterSetName = "VpgSettingsIdentifier"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("sid", "settingsIdentifier", "vpgSettingsId")]
|
||||
[String]$vpgSettingsIdentifier,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Target VPG Name to Add the VM",
|
||||
ParameterSetName = "VpgName"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$VpgName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of VM(s) to add to the VPG"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String[]]$Vm
|
||||
)
|
||||
|
||||
begin {
|
||||
|
||||
}
|
||||
|
||||
process {
|
||||
if ($PSCmdlet.ParameterSetName -eq "VpgName") {
|
||||
$VpgIdentifier = Get-ZertoVpg -name $VpgName | Select-Object -ExpandProperty VpgIdentifier
|
||||
if (-not $VpgIdentifier) {
|
||||
Write-Error "Unable to find Vpg with name $VpgName. Please check your parameters and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgIdentifier
|
||||
}
|
||||
}
|
||||
$baseUrl = "vpgsettings/{0}/vms" -f $vpgSettingsIdentifier
|
||||
$baseSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
if ($PSCmdlet.ParameterSetName -eq "VpgSettingsIdentifier") {
|
||||
$VpgName = $baseSettings.Basic.Name
|
||||
}
|
||||
$unprotectedVms = Get-ZertoUnprotectedVm
|
||||
$protectedVms = Get-ZertoProtectedVm
|
||||
$vmMap = Get-Map -inputObject $unprotectedVms -key VmName -value VmIdentifier
|
||||
$vmMap = $vmMap + (Get-Map -inputObject $protectedVms -key VmName -value VmIdentifier)
|
||||
# Create array of VM identifiers
|
||||
$vmIdentifiers = foreach ($machine in ($Vm | Select-Object -Unique)) {
|
||||
if ($vmMap[$machine] -notin $baseSettings.Vms.vmIdentifier ) {
|
||||
# If the VM is unprotected, get the identifier
|
||||
$vmIdentifier = $unprotectedVms | Where-Object { $_.vmName -like $machine } | Select-Object -ExpandProperty vmIdentifier
|
||||
# If the VM is not unprotected, check the protected VMs
|
||||
if ( -not $vmIdentifier) {
|
||||
# Get all identifiers to test if the VM is eligible to be a member of an additional VPG
|
||||
$results = $protectedVms | Where-Object { $_.VmName -like $machine } | Select-Object -ExpandProperty vmIdentifier
|
||||
$recoverySiteIdentifiers = $protectedVms | Where-Object { $_.VmName -like $machine } | Select-Object -ExpandProperty RecoverySite | Select-Object -ExpandProperty identifier
|
||||
# If VM is currently a member of 3 VPGs, skip it. If it cannot be found, skip it. Otherwise, set the identifier
|
||||
if ($baseSettings.basic.RecoverySiteIdentifier -in $recoverySiteIdentifiers) {
|
||||
Write-Warning "$machine is already replicating to target site. It cannot be added to an additional VPG replicating to that site. Please check your configurations and try again. Skipping $machine"
|
||||
continue
|
||||
} elseif ($results.count -eq 3) {
|
||||
Write-Warning "$machine is already a part of 3 VPGs and cannot be part of an additional VPG. Skipping $machine"
|
||||
continue
|
||||
} elseif ($results.count -eq 0) {
|
||||
Write-Warning "$machine not found. Skipping $machine"
|
||||
continue
|
||||
} else {
|
||||
$vmIdentifier = $results | Select-Object -First 1
|
||||
}
|
||||
}
|
||||
# Create a custom object to store the information to easily convert to JSON. Return to vmIdentifiers array.
|
||||
$vmIdentifier
|
||||
} else {
|
||||
Write-Warning "$machine is already a member of this VPG Settings object. It will not be added again. Skipping $machine"
|
||||
continue
|
||||
}
|
||||
}
|
||||
if ($vmIdentifiers.Count -gt 0 -and $PSCmdlet.ShouldProcess($VmIdentifiers, "Adding VM(s): $Vm to Vpg $VpgName")) {
|
||||
foreach ($id in $VmIdentifiers) {
|
||||
# Build the Body
|
||||
$Body = @{VmIdentifier = $id }
|
||||
# Submit the request. Out to Null to prevent line returns while running.
|
||||
$null = Invoke-ZertoRestRequest -uri $baseUrl -method POST -body ($Body | ConvertTo-Json -Depth 10)
|
||||
}
|
||||
|
||||
$vpgSettingsIdentifier
|
||||
} else {
|
||||
Write-Warning "No VMs found to add. Please check your parameters and try again."
|
||||
if ($PSCmdlet.ParameterSetName -eq "VpgName") {
|
||||
Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,11 +5,18 @@ function Connect-ZertoServer {
|
||||
param(
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "IP address or FQDN of your Zerto Management Server"
|
||||
HelpMessage = "IP address or FQDN of your Zerto Management Server",
|
||||
Position = 0
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("server", "zvm")]
|
||||
[string]$zertoServer,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Valid credentials to connect to the Zerto Management Server",
|
||||
Position = 1
|
||||
)]
|
||||
[System.Management.Automation.PSCredential]$credential,
|
||||
[Parameter(
|
||||
HelpMessage = "Zerto Virtual Manager management port. Default value is 9669."
|
||||
)]
|
||||
@@ -18,11 +25,14 @@ function Connect-ZertoServer {
|
||||
[Alias("port")]
|
||||
[string]$zertoPort = "9669",
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Valid credentials to connect to the Zerto Management Server"
|
||||
HelpMessage = "Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused"
|
||||
)]
|
||||
[switch]$AutoReconnect,
|
||||
[Parameter(
|
||||
HelpMessage = "Use this switch to return the headers to a specified variable or to the default output."
|
||||
)]
|
||||
[System.Management.Automation.PSCredential]$credential,
|
||||
[switch]$returnHeaders
|
||||
|
||||
)
|
||||
|
||||
begin {
|
||||
@@ -38,6 +48,10 @@ function Connect-ZertoServer {
|
||||
"Accept" = "application/json"
|
||||
"zerto-triggered-by" = "PowershellWes"
|
||||
}
|
||||
Set-Variable -Name Reconnect -Scope Script -Value $AutoReconnect.IsPresent
|
||||
if ($Script:Reconnect) {
|
||||
Set-Variable -Name CachedCredential -Scope Script -Value $credential
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
@@ -48,10 +62,7 @@ function Connect-ZertoServer {
|
||||
end {
|
||||
# Build Headers Hashtable with Authorization Token
|
||||
$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-Variable -Name zvmHeaders -Scope Script -Value $zertoAuthorizationHeaders
|
||||
Set-Variable -Name zvmLocalInfo -Scope Script -Value (Get-ZertoLocalSite)
|
||||
|
||||
|
||||
# Have the option to return the headers to a variable
|
||||
if ($returnHeaders) {
|
||||
return $Script:zvmHeaders
|
||||
|
||||
@@ -12,5 +12,4 @@ function Disconnect-ZertoServer {
|
||||
Remove-Variable -Name zvmPort -Scope Script
|
||||
Remove-Variable -Name zvmLastAction -Scope Script
|
||||
Remove-Variable -Name zvmHeaders -Scope Script
|
||||
Remove-Variable -Name zvmLocalInfo -Scope Script
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Get-ZertoAzureResource {
|
||||
[CmdletBinding(DefaultParameterSetName = "SiteNameVmInstanceType")]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteNameSecurityGroup"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteNameSubnet"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteNameNetwork"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteNameVmInstanceType"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$SiteName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteIdentifierSecurityGroup"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteIdentifierSubnet"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteIdentifierNetwork"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Site Identifier of the Azure Site you wish to get the information.",
|
||||
ParameterSetName = "SiteIdentifierVmInstanceType"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$SiteIdentifier,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteIdentifierSecurityGroup",
|
||||
HelpMessage = "Use this switch to get information about the supported Security Groups"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteNameSecurityGroup",
|
||||
HelpMessage = "Use this switch to get information about the supported Security Groups"
|
||||
)]
|
||||
[Switch]$SecurityGroup,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteIdentifierSubnet",
|
||||
HelpMessage = "Use this switch to get information about the supported Subnets"
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteNameSubnet",
|
||||
HelpMessage = "Use this switch to get information about the supported Subnets"
|
||||
)]
|
||||
[Switch]$Subnet,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteIdentifierNetwork",
|
||||
HelpMessage = "Use this switch to get information about the supported Networks (VNets)."
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteNameNetwork",
|
||||
HelpMessage = "Use this switch to get information about the supported Networks (VNets)."
|
||||
)]
|
||||
[Switch]$Network,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteIdentifierVmInstanceType",
|
||||
HelpMessage = "Use this switch to get information about the supported Vm Instance Types."
|
||||
)]
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
ParameterSetName = "SiteNameVmInstanceType",
|
||||
HelpMessage = "Use this switch to get information about the supported Vm Instance Types."
|
||||
)]
|
||||
[Switch]$VmInstanceType
|
||||
)
|
||||
|
||||
begin {
|
||||
|
||||
}
|
||||
|
||||
process {
|
||||
if ($PSCmdlet.ParameterSetName -match "SiteName") {
|
||||
$SiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $SiteName }
|
||||
if ($null -eq $SiteInfo) {
|
||||
Write-Error "Unable to find a peer site with the name $SiteName. Please check your parameters and try again." -ErrorAction Stop
|
||||
}
|
||||
$SiteIdentifier = $SiteInfo | Select-Object -ExpandProperty SiteIdentifier
|
||||
} else {
|
||||
$SiteInfo = Get-ZertoPeerSite -siteIdentifier $SiteIdentifier
|
||||
if ($null -eq $SiteInfo) {
|
||||
Write-Error "Unable to find a peer site with identifier of $SiteIdentifier. Please check your parameters and try again." -ErrorAction Stop
|
||||
}
|
||||
}
|
||||
if ($SiteInfo.SiteType -notmatch "Azure") {
|
||||
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
|
||||
}
|
||||
$baseUri = "virtualizationsites/{0}/publicCloud" -f $SiteIdentifier
|
||||
|
||||
switch -wildcard ($PSCmdlet.ParameterSetName) {
|
||||
"*VmInstanceType" {
|
||||
$uri = "{0}/VmInstanceType" -f $baseUri
|
||||
}
|
||||
"*Subnet" {
|
||||
$uri = "{0}/subnets" -f $baseUri
|
||||
}
|
||||
"*Network" {
|
||||
$uri = "{0}/virtualNetworks" -f $baseUri
|
||||
}
|
||||
"*SecurityGroup" {
|
||||
$uri = "{0}/securityGroups" -f $baseUri
|
||||
}
|
||||
}
|
||||
Invoke-ZertoRestRequest -uri $uri
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,6 @@
|
||||
function Get-ZertoUnprotectedVm {
|
||||
[cmdletbinding()]
|
||||
param()
|
||||
$uri = "virtualizationsites/{0}/vms" -f $script:zvmLocalInfo.siteidentifier
|
||||
$uri = "virtualizationsites/{0}/vms" -f (Get-ZertoLocalSite).siteIdentifier
|
||||
Invoke-ZertoRestRequest -uri $uri
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ function Install-ZertoVra {
|
||||
# If the VRA does not exist, proceed with the installation. If it does exist, bypass and
|
||||
if ( -not (Get-ZertoVra -vraName $vraName) ) {
|
||||
# Get identifiers for each item provided by name.
|
||||
$siteIdentifier = $script:zvmLocalInfo.SiteIdentifier
|
||||
$siteIdentifier = (Get-ZertoLocalSite).SiteIdentifier
|
||||
$hostIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -hosts | Where-Object { $_.VirtualizationHostName -eq $hostName } | Select-Object hostIdentifier -ExpandProperty hostIdentifier
|
||||
$networkIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -networks | Where-Object { $_.VirtualizationNetworkName -eq $networkName } | Select-Object NetworkIdentifier -ExpandProperty NetworkIdentifier
|
||||
$datastoreIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -datastores | Where-Object { $_.DatastoreName -eq $datastoreName } | Select-Object DatastoreIdentifier -ExpandProperty DatastoreIdentifier
|
||||
|
||||
@@ -1,22 +1,57 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Invoke-ZertoMove {
|
||||
[CmdletBinding( DefaultParameterSetName = "main", SupportsShouldProcess = $true )]
|
||||
[CmdletBinding( DefaultParameterSetName = "id", SupportsShouldProcess = $true )]
|
||||
param(
|
||||
[Parameter(
|
||||
ParameterSetName = 'name',
|
||||
HelpMessage = "Name(s) of the VPG(s) you want to move.",
|
||||
Mandatory
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'commitName',
|
||||
HelpMessage = "Name(s) of the VPG(s) you want to move.",
|
||||
Mandatory
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string[]]$vpgName,
|
||||
[Parameter(
|
||||
ParameterSetName = 'id',
|
||||
HelpMessage = "ID(s) of the VPG(s) you want to move.",
|
||||
Mandatory,
|
||||
ValueFromPipelineByPropertyName
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'commitId',
|
||||
HelpMessage = "ID(s) of the VPG(s) you want to move.",
|
||||
Mandatory,
|
||||
ValueFromPipelineByPropertyName
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[guid[]]$vpgIdentifier,
|
||||
[Parameter(
|
||||
ParameterSetName = 'commitName',
|
||||
HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
|
||||
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
|
||||
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
|
||||
Default is the Site Settings setting."
|
||||
Default is the Site Settings setting.",
|
||||
Mandatory
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'commitId',
|
||||
HelpMessage = "'Rollback': After the seconds specified in the commitValue setting have elapsed, the failover is rolled back.
|
||||
'Commit': After the seconds specified in the commitValue setting have elapsed, the failover continues, committing the virtual machines in the recovery site.
|
||||
'None': The virtual machines in the VPG being failed over remain in the Before Commit state until either they are committed with Commit a failover, or rolled back with Roll back a failover.
|
||||
Default is the Site Settings setting.",
|
||||
Mandatory
|
||||
)]
|
||||
[ValidateSet("Rollback", "Commit", "None")]
|
||||
[string]$commitPolicy,
|
||||
[Parameter(
|
||||
ParameterSetName = 'commitName',
|
||||
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
|
||||
)]
|
||||
[Parameter(
|
||||
ParameterSetName = 'commitId',
|
||||
HelpMessage = "The amount of time, in seconds, the Move is in a 'Before Commit' state, before performing the commitPolicy setting. If omitted, the site settings default will be applied."
|
||||
)]
|
||||
# Min 5 Minutes, Max 24 Hours, Default Site Settigns.
|
||||
@@ -27,15 +62,11 @@ function Invoke-ZertoMove {
|
||||
)]
|
||||
[switch]$forceShutdown,
|
||||
[Parameter(
|
||||
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.",
|
||||
Mandatory
|
||||
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."
|
||||
)]
|
||||
[switch]$disableReverseProtection,
|
||||
[Parameter(
|
||||
ParameterSetName = "keepSourceVms",
|
||||
HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.",
|
||||
Mandatory
|
||||
HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection."
|
||||
)]
|
||||
[switch]$keepSourceVms,
|
||||
[Parameter(
|
||||
@@ -46,52 +77,50 @@ function Invoke-ZertoMove {
|
||||
|
||||
begin {
|
||||
$baseUri = "vpgs"
|
||||
$body = @{
|
||||
forceShutdown = $forceShutdown.IsPresent
|
||||
ContinueOnPreScriptFailure = $ContinueOnPreScriptFailure.IsPresent
|
||||
keepSourceVms = $keepSourceVms.IsPresent
|
||||
reverseProtection = -not $disableReverseProtection.IsPresent
|
||||
}
|
||||
|
||||
if ( $keepSourceVms.IsPresent -and -not $disableReverseProtection.IsPresent ) {
|
||||
Write-Verbose 'Disabling reverse protection as keepSourceVms requires it'
|
||||
$body['reverseProtection'] = $false
|
||||
}
|
||||
|
||||
if ($PSBoundParameters.ContainsKey('commitPolicy')) {
|
||||
$body['commitPolicy'] = $commitPolicy
|
||||
if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) {
|
||||
$body['commitPolicyTimeout'] = $commitPolicyTimeout
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
process {
|
||||
$body = @{ }
|
||||
#TODO - use a foreach loop to populate the body without all the if statments
|
||||
if ($PSBoundParameters.ContainsKey('commitPolicy')) {
|
||||
$body['commitPolicy'] = $commitPolicy
|
||||
}
|
||||
if ($PSBoundParameters.ContainsKey('commitPolicyTimeout')) {
|
||||
$body['commitPolicyTimeout'] = $commitPolicyTimeout
|
||||
}
|
||||
if ($PSBoundParameters.ContainsKey('forceShutdown')) {
|
||||
$body['forceShutdown'] = $true
|
||||
} else {
|
||||
$body['forceShutdown'] = $false
|
||||
}
|
||||
if ($PSBoundParameters.ContainsKey('ContinueOnPreScriptFailure')) {
|
||||
$body['ContinueOnPreScriptFailure'] = $true
|
||||
} else {
|
||||
$body['ContinueOnPreScriptFailure'] = $false
|
||||
}
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
"disableReverseProtection" {
|
||||
$body['reverseProtection'] = $false
|
||||
$body['keepSourceVms'] = $false
|
||||
{ $_ -in 'name', 'commitName' } {
|
||||
$vpgIds = foreach ($name in $vpgName) {
|
||||
$vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier
|
||||
if ( -not $vpgId ) {
|
||||
Write-Error "VPG: '$name' not found. Please check the name and try again. Skipping"
|
||||
} else {
|
||||
Write-Verbose "VPG: $name, ID: $vpgId"
|
||||
$vpgId
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"keepSourceVms" {
|
||||
$body['reverseProtection'] = $false
|
||||
$body['keepSourceVms'] = $true
|
||||
}
|
||||
|
||||
"main" {
|
||||
$body['reverseProtection'] = $true
|
||||
$body['keepSourceVms'] = $false
|
||||
{ $_ -in 'id', 'commitId' } {
|
||||
$vpgIds = $vpgIdentifier
|
||||
}
|
||||
}
|
||||
foreach ($name in $vpgName) {
|
||||
$vpgId = $(Get-ZertoVpg -name $name).vpgIdentifier
|
||||
if ( -not $vpgId ) {
|
||||
Write-Error "VPG: $name not found. Please check the name and try again. Skipping"
|
||||
} else {
|
||||
$uri = "{0}/{1}/move" -f $baseUri, $vpgId
|
||||
if ($PSCmdlet.ShouldProcess("Moving VPG: $name with settings: $($body | convertto-json)")) {
|
||||
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
|
||||
}
|
||||
|
||||
foreach ($thisId in $vpgIds) {
|
||||
$uri = "{0}/{1}/move" -f $baseUri, $thisId
|
||||
if ($PSCmdlet.ShouldProcess("Moving VPG: $thisId with settings: $($body | ConvertTo-Json)")) {
|
||||
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,24 +41,26 @@ function Invoke-ZertoRestRequest {
|
||||
}
|
||||
|
||||
# If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired
|
||||
if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) ) {
|
||||
if ( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $False ) {
|
||||
Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager"
|
||||
} else {
|
||||
|
||||
# Build the URI to be submitted
|
||||
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
|
||||
try {
|
||||
# Set the zvmLastAction time and try to submit the REST Request
|
||||
$script:zvmLastAction = (Get-Date).Ticks
|
||||
# If running PwSh - Use this Invoke-RestMethod with passed Variables
|
||||
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100
|
||||
} else {
|
||||
# If running PowerShell 5.1 --> Do the Following
|
||||
# Check to see if All Certs are Trusted. If not, Create the Policy to Trust All Certificates
|
||||
if ([System.Net.ServicePointManager]::CertificatePolicy.GetType().Name -ne "TrustAllCertsPolicy") {
|
||||
Try {
|
||||
$type = @'
|
||||
} elseif (( (Test-Path variable:script:zvmHeaders) -and $([datetime]$script:zvmLastAction).addMinutes(30) -lt $(Get-Date) -and $Script:Reconnect -eq $True )) {
|
||||
Write-Verbose "Authorization had expired. Attempting Reauthorization."
|
||||
Connect-ZertoServer -zertoServer $Script:zvmServer -zertoPort $script:zvmPort -credential $Script:CachedCredential
|
||||
}# else {
|
||||
# Build the URI to be submitted
|
||||
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
|
||||
try {
|
||||
# Set the zvmLastAction time and try to submit the REST Request
|
||||
$script:zvmLastAction = (Get-Date).Ticks
|
||||
# If running PwSh - Use this Invoke-RestMethod with passed Variables
|
||||
if ($PSVersionTable.PSVersion.Major -ge 6) {
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100
|
||||
} else {
|
||||
# If running PowerShell 5.1 --> Do the Following
|
||||
# Check to see if All Certs are Trusted. If not, Create the Policy to Trust All Certificates
|
||||
if ([System.Net.ServicePointManager]::CertificatePolicy.GetType().Name -ne "TrustAllCertsPolicy") {
|
||||
Try {
|
||||
$type = @'
|
||||
using System.Net;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
@@ -67,42 +69,42 @@ public class TrustAllCertsPolicy : ICertificatePolicy {
|
||||
}
|
||||
}
|
||||
'@
|
||||
Add-Type -TypeDefinition $type -ErrorAction SilentlyContinue
|
||||
} Catch {
|
||||
if ($error[0].Exception -ne "Cannot add type. The type name 'TrustAllCertsPolicy already exists.") {
|
||||
Write-Debug $error[0]
|
||||
}
|
||||
Add-Type -TypeDefinition $type -ErrorAction SilentlyContinue
|
||||
} Catch {
|
||||
if ($error[0].Exception -ne "Cannot add type. The type name 'TrustAllCertsPolicy already exists.") {
|
||||
Write-Debug $error[0]
|
||||
}
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
}
|
||||
[System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
|
||||
|
||||
}
|
||||
# If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers as expected.
|
||||
if ($uri -eq "session/add" -and $method -eq "POST") {
|
||||
$apiRequestResults = Invoke-WebRequest -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
$responseHeaders = @{ }
|
||||
$responseHeaders['x-zerto-session'] = @($apiRequestResults.Headers['x-zerto-session'])
|
||||
} elseif ($method -ne "GET") {
|
||||
# If the Method is something other than 'GET' use this call with a body parameter
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
} else {
|
||||
# If the Method we are calling is 'GET' use this call without a body parameter
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
# If an error is encountered, Catch
|
||||
Write-Error -ErrorRecord $_ -ErrorAction $callerErrorActionPreference
|
||||
# If we are authenticating to the ZVM, Use this block to use Invoke-WebRequest and format the Headers as expected.
|
||||
if ($uri -eq "session/add" -and $method -eq "POST") {
|
||||
$apiRequestResults = Invoke-WebRequest -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
$responseHeaders = @{ }
|
||||
$responseHeaders['x-zerto-session'] = @($apiRequestResults.Headers['x-zerto-session'])
|
||||
} elseif ($method -ne "GET") {
|
||||
# If the Method is something other than 'GET' use this call with a body parameter
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
} else {
|
||||
# If the Method we are calling is 'GET' use this call without a body parameter
|
||||
$apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -ContentType $contentType -Credential $credential -TimeoutSec 100
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
# If an error is encountered, Catch
|
||||
Write-Error -ErrorRecord $_ -ErrorAction $callerErrorActionPreference
|
||||
}
|
||||
|
||||
# If the calling function does not need the headers (Default Action) return the results of the API Call
|
||||
if (-not $returnHeaders) {
|
||||
return $apiRequestResults
|
||||
} else {
|
||||
#If Headers are required, build a PS Custom Object with the Results and the Headers
|
||||
$apiRequestAndHeaderResults = New-Object -TypeName psobject
|
||||
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "apiRequestResults" -Value $apiRequestResults
|
||||
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "Headers" -Value $responseHeaders
|
||||
return $apiRequestAndHeaderResults
|
||||
}
|
||||
# If the calling function does not need the headers (Default Action) return the results of the API Call
|
||||
if (-not $returnHeaders) {
|
||||
return $apiRequestResults
|
||||
} else {
|
||||
#If Headers are required, build a PS Custom Object with the Results and the Headers
|
||||
$apiRequestAndHeaderResults = New-Object -TypeName psobject
|
||||
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "apiRequestResults" -Value $apiRequestResults
|
||||
$apiRequestAndHeaderResults | Add-Member -MemberType NoteProperty -Name "Headers" -Value $responseHeaders
|
||||
return $apiRequestAndHeaderResults
|
||||
#}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function New-ZertoAzureVpg {
|
||||
[CmdletBinding()]
|
||||
# Ignoring Should Process PSSA rule. Change is in memory and not committed untill the Save-ZertoVpgSetting function is called.
|
||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
|
||||
param(
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Desired name of the VPG to be created."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]$Name,
|
||||
[Parameter(
|
||||
HelpMessage = "Replication priority of the VPG to be created. Default value is 'Medium'"
|
||||
)]
|
||||
[ValidateSet("High", "Medium", "Low")]
|
||||
[string]$Priority = "Medium",
|
||||
[Parameter(
|
||||
HelpMessage = "Desired journal history in hours of the VPG to be created. Min 1 hour, Max 720 hours (30 days). Default is 24 hours."
|
||||
)]
|
||||
[ValidateRange(1, 720)]
|
||||
[Int]$JournalHistoryInHours = 24,
|
||||
[Parameter(
|
||||
HelpMessage = "Desired RPO alert value in seconds. Min 60 seconds, Max 86400 seconds (24 hours). Default is 300 seconds (5 minutes)."
|
||||
)]
|
||||
[ValidateRange(60, 86400)]
|
||||
[Int]$RpoInSeconds = 300,
|
||||
[Parameter(
|
||||
HelpMessage = "Desired test interval in minutes. Please review documentation for values. Default is 262080 minutes (6 months)."
|
||||
)]
|
||||
[ValidateSet(0, 43200, 131040, 262080, 394560, 525600)]
|
||||
[Int]$TestIntervalInMinutes = 262080,
|
||||
[Parameter(
|
||||
HelpMessage = "Turn on or off WAN compression. Recommended this setting is not turned off. Default is to leave WAN compression turned on."
|
||||
)]
|
||||
[Bool]$UseWanCompression = $True,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the ZCA site for the VPG to target."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TargetSiteName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default Network (VNet) to use during a live operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveNetworkName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default subnet to use during a live operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveSubnetName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default Security Group to use during a live operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveSecurityGroupName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default VM Instance Type to use during a live operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$LiveInstanceType,
|
||||
[Parameter(
|
||||
HelpMessage = "Type of disk to select as the default for the VPG during a live operation. Default is 'ManagedPremiumSSD'"
|
||||
)]
|
||||
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
|
||||
[String]$LiveDiskType = "ManagedPremiumSSD",
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default Network (VNet) to use during a test operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestNetworkName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default subnet to use during a test operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestSubnetName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default Security Group to use during a test operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestSecurityGroupName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the default VM Instance Type to use during a test operation."
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$TestInstanceType,
|
||||
[Parameter(
|
||||
HelpMessage = "Type of disk to select as the default for the VPG during a live operation. Default is 'ManagedPremiumSSD'"
|
||||
)]
|
||||
[ValidateSet("UnmanagedStandard", "ManagedPremiumSSD", "ManagedStandardSSD", "ManagedStandardHDD")]
|
||||
[String]$TestDiskType = "ManagedPremiumSSD"
|
||||
)
|
||||
|
||||
begin {
|
||||
# Grab local site identifier and target site information and identifier
|
||||
$LocalSiteIdentifier = Get-ZertoLocalSite | Select-Object -ExpandProperty SiteIdentifier
|
||||
$TargetSiteInfo = Get-ZertoPeerSite | Where-Object { $_.PeerSiteName -match $TargetSiteName }
|
||||
$TargetSiteIdentifier = $TargetSiteInfo | Select-Object -ExpandProperty SteIdentifier
|
||||
|
||||
# Validate site identifier and site type.
|
||||
if ($null -eq $TargetSiteIdentifier) {
|
||||
Write-Error "Unable to find target site with name $TargetSiteName. Please check the name and try again" -ErrorAction Stop
|
||||
} elseif ($TargetSiteInfo.SiteType -notmatch "Azure") {
|
||||
Write-Error "Specified site is not an Azure site. Please specify an Azure site and try again." -ErrorAction Stop
|
||||
}
|
||||
|
||||
# Build Maps for quick lookups and validation
|
||||
$NetworksMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Network) -Key "VirtualNetworkName" -Value "VirtualNetworkIdentifier"
|
||||
$SubnetsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -Subnet) -Key "SubnetName" -Value "SubnetIdentifier"
|
||||
$SecurityGroupsMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -SecurityGroup) -Key "SecurityGroupName" -Value "SecurityGroupIdentifier"
|
||||
$InstancesMap = GetMap -InputObject (Get-ZertoAzureResource -SiteIdentifier $TargetSiteIdentifier -VmInstanceType) -Key "VmInstanceType" -Value "IsPremiumSupported"
|
||||
|
||||
# Validate instance types and ensure case insensitivity
|
||||
$TestInstanceType = $Instances.Where( { $_.VmInstanceType -match $TestInstanceType }) | Select-Object -ExpandProperty VmInstanceType
|
||||
$LiveInstanceType = $Instances.Where( { $_.VmInstanceType -match $LiveInstanceType }) | Select-Object -ExpandProperty VmInstanceType
|
||||
|
||||
# Validate parameters are found at target site and Instance and Disk Types are valid
|
||||
if ($null -eq $NetworksMap[$LiveNetworkName]) {
|
||||
Write-Error "Unable to find network with name $LiveNetworkName. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($null -eq $SubnetsMap[$LiveSubnetName]) {
|
||||
Write-Error "Unable to find subnet with name $LiveSubnetName. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($null -eq $SecurityGroupsMap[$LiveSecurityGroupName]) {
|
||||
Write-Error "Unable to find security group with name $LiveSecurityGroupName. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($LiveInstanceType -notin $Instances.VmInstanceType) {
|
||||
Write-Error "Unable to find a supported VM Instance Type with name $LiveInstanceType. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($null -eq $NetworksMap[$TestNetworkName]) {
|
||||
Write-Error "Unable to find network with name $TestNetworkName. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($null -eq $SubnetsMap[$TestSubnetName]) {
|
||||
Write-Error "Unable to find subnet with name $TestSubnetName. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($null -eq $SecurityGroupsMap[$TestSecurityGroupName]) {
|
||||
Write-Error "Unable to find security group with name $TestSecurityGroupName. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($TestInstanceType -notin $Instances.VmInstanceType) {
|
||||
Write-Error "Unable to find a supported VM Instance Type with name $TestInstanceType. Please check the name and try again." -ErrorAction Stop
|
||||
} elseif ($LiveDiskType -eq "ManagedPremiumSSD" -and ( -not $InstancesMap[$LiveInstanceType])) {
|
||||
Write-Error "$LiveDiskType disk type is not supported on the selected instance $LiveInstanceType. Please check your settings and try again." -ErrorAction Stop
|
||||
} elseif ($LiveDiskType -ne "ManagedPremiumSSD" -and $InstancesMap[$LiveInstanceType]) {
|
||||
Write-Error "$TestDiskType disk type is not supported on the selected instance $LiveInstanceType. Please check your settings and try again." -ErrorAction Stop
|
||||
} elseif ($TestDiskType -eq "ManagedPremiumSSD" -and ( -not $InstancesMap[$TestInstanceType])) {
|
||||
Write-Error "$TestDiskType disk type is not supported on the selected instance $TestInstanceType. Please check your settings and try again." -ErrorAction Stop
|
||||
} elseif ($TestDiskType -ne "ManagedPremiumSSD" -and $InstancesMap[$TestInstanceType]) {
|
||||
Write-Error "$TestDiskType disk type is not supported on the selected instance $TestInstanceType. Please check your settings and try again." -ErrorAction Stop
|
||||
}
|
||||
|
||||
# Create the VPG Settings Identifier and get the skeleton
|
||||
$VpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -newVpg
|
||||
$Settings = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier
|
||||
|
||||
# Set the VPG Settings URI
|
||||
$VpgSettingsBaseUri = "vpgSettings/{0}" -f $VpgSettingsIdentifier
|
||||
|
||||
# Populate the skeleton with the basic information
|
||||
$Settings.Basic.Name = $Name
|
||||
$Settings.Basic.Priority = $Priority
|
||||
$Settings.Basic.JournalHistoryInHours = $JournalHistoryInHours
|
||||
$Settings.Basic.ProtectedSiteIdentifier = $LocalSiteIdentifier
|
||||
$Settings.Basic.RecoverySiteIdentifier = $TargetSiteIdentifier
|
||||
$Settings.Basic.RpoInSeconds = $RpoInSeconds
|
||||
$Settings.Basic.TestIntervalInMinutes = $TestIntervalInMinutes
|
||||
$Settings.Basic.UseWanCompression = $UseWanCompression
|
||||
|
||||
# Put the basic information to get am Azure Skeleton for the remainder of the default settings
|
||||
$null = Invoke-ZertoRestRequest -method PUT -uri $VpgSettingsBaseUri -body ($Settings | ConvertTo-Json -Depth 10)
|
||||
Start-Sleep -Milliseconds 500
|
||||
|
||||
# Get an updated Skeleton with Azure specific settings to populate and populate them
|
||||
$Settings = Get-ZertoVpgSetting -vpgSettingsIdentifier $VpgSettingsIdentifier
|
||||
$Settings.Networks.Failover.PublicCloud.VirtualNetworkIdentifier = $NetworksMap[$LiveNetworkName]
|
||||
$Settings.Networks.Failover.PublicCloud.SubnetIdentifier = $SubnetsMap[$LiveSubnetName]
|
||||
$Settings.Networks.Failover.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$LiveSecurityGroupName]
|
||||
$Settings.Networks.FailoverTest.PublicCloud.VirtualNetworkIdentifier = $NetworksMap[$TestNetworkName]
|
||||
$Settings.Networks.FailoverTest.PublicCloud.SubnetIdentifier = $SubnetsMap[$TestSubnetName]
|
||||
$Settings.Networks.FailoverTest.PublicCloud.SecurityGroupIdentifier = $SecurityGroupsMap[$TestSecurityGroupName]
|
||||
$Settings.Recovery.PublicCloud.Failover.VmInstanceType = $LiveInstanceType
|
||||
$Settings.Recovery.PublicCloud.Failover.Azure.RecoveryDiskType = $LiveDiskType
|
||||
$Settings.Recovery.PublicCloud.FailoverTest.VmInstanceType = $TestInstanceType
|
||||
$Settings.Recovery.PublicCloud.FailoverTest.Azure.RecoveryDiskType = $TestDiskType
|
||||
|
||||
# Update the VPG Settings on the Server with a PUT request
|
||||
$null = Invoke-ZertoRestRequest -method PUT -uri $VpgSettingsBaseUri -body ($Settings | ConvertTo-Json -Depth 10)
|
||||
|
||||
# Return the VPG Settings Identifier to use when adding VMs to the VPG.
|
||||
$VpgSettingsIdentifier
|
||||
}
|
||||
|
||||
process {
|
||||
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function New-ZertoVpg {
|
||||
[cmdletbinding(SupportsShouldProcess = $true)]
|
||||
[cmdletbinding(SupportsShouldProcess = $true, DefaultParameterSetName = "recoveryHostDatastore")]
|
||||
param(
|
||||
[Parameter(
|
||||
HelpMessage = "Name of the VPG",
|
||||
@@ -165,7 +165,7 @@ function New-ZertoVpg {
|
||||
begin {
|
||||
# Create an identifiers table, and start converting names to identifiers.
|
||||
$identifiersTable = @{ }
|
||||
$identifiersTable['recoverySiteIdentifier'] = $(Get-ZertoPeerSite -peerName $recoverySite).siteIdentifier
|
||||
$identifiersTable['recoverySiteIdentifier'] = (Get-ZertoPeerSite).Where({$_.PeerSiteName -like $recoverySite}) | Select-Object -ExpandProperty SiteIdentifier
|
||||
$peerSiteNetworks = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -networks)
|
||||
$identifiersTable['failoverNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $recoveryNetwork } | Select-Object -ExpandProperty NetworkIdentifier
|
||||
$identifiersTable['testNetworkIdentifier'] = $peerSiteNetworks | Where-Object { $_.VirtualizationNetworkName -like $testNetwork } | Select-Object -ExpandProperty NetworkIdentifier
|
||||
@@ -182,18 +182,18 @@ function New-ZertoVpg {
|
||||
# Get identifiers based on parameter set name
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
"recoveryClusterDatastoreCluster" {
|
||||
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostclusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
|
||||
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
|
||||
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostClusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
|
||||
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
|
||||
}
|
||||
|
||||
"recoveryClusterDatastore" {
|
||||
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostclusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
|
||||
$identifiersTable['clusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hostClusters | Where-Object { $_.VirtualizationClusterName -like $recoveryCluster }).ClusterIdentifier
|
||||
$identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier
|
||||
}
|
||||
|
||||
"recoveryHostDatastoreCluster" {
|
||||
$identifiersTable['recoveryHostIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -hosts | Where-Object { $_.VirtualizationHostName -like $recoveryHost }).HostIdentifier
|
||||
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
|
||||
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
|
||||
}
|
||||
|
||||
"recoveryHostDatastore" {
|
||||
@@ -202,12 +202,12 @@ function New-ZertoVpg {
|
||||
}
|
||||
|
||||
"recoveryResourcePoolDatastoreCluster" {
|
||||
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcepools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
|
||||
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreclusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
|
||||
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcePools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
|
||||
$identifiersTable['datastoreClusterIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastoreClusters | Where-Object { $_.DatastoreClusterName -like $datastoreCluster }).DatastoreClusterIdentifier
|
||||
}
|
||||
|
||||
"recoveryResourcePoolDatastore" {
|
||||
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcepools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
|
||||
$identifiersTable['recoveryResourcePoolIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -resourcePools | Where-Object { $_.ResourcePoolName -like $recoveryResourcePool }).ResourcePoolIdentifier
|
||||
$identifiersTable['datastoreIdentifier'] = $(Get-ZertoVirtualizationSite -siteIdentifier $identifiersTable['recoverySiteIdentifier'] -datastores | Where-Object { $_.DatastoreName -like $datastore }).DatastoreIdentifier
|
||||
}
|
||||
}
|
||||
@@ -295,11 +295,11 @@ function New-ZertoVpg {
|
||||
|
||||
"recoveryHostDatastoreCluster" {
|
||||
$baseSettings.Recovery.DefaultDatastoreClusterIdentifier = $identifiersTable['datastoreClusterIdentifier']
|
||||
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier']
|
||||
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier']
|
||||
}
|
||||
|
||||
"recoveryHostDatastore" {
|
||||
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['hostIdentifier']
|
||||
$baseSettings.Recovery.DefaultHostIdentifier = $identifiersTable['recoveryHostIdentifier']
|
||||
$baseSettings.Recovery.DefaultDatastoreIdentifier = $identifiersTable['datastoreIdentifier']
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
|
||||
function Remove-ZertoVpgVm {
|
||||
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = "High")]
|
||||
param (
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of the VPG that contains the VM you wish to remove",
|
||||
ParameterSetName = "VpgName"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String]$VpgName,
|
||||
[Parameter(
|
||||
Mandatory,
|
||||
HelpMessage = "Name of VM(s) to remove from the VPG"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[String[]]$Vm
|
||||
)
|
||||
|
||||
begin {
|
||||
|
||||
}
|
||||
|
||||
process {
|
||||
$VpgData = Get-ZertoVpg -vpgName $VpgName
|
||||
if (-not $VpgData) {
|
||||
Write-Error "Unable to find Vpg with name $VpgName. Please check your parameters and try again." -ErrorAction Stop
|
||||
} else {
|
||||
$protectedVms = Get-ZertoProtectedVm -vpgName $VpgData.VpgName
|
||||
}
|
||||
$VmIdentifiers = foreach ($machine in ($vm | Select-Object -Unique)) {
|
||||
if ($machine -in $protectedVms.VmName) {
|
||||
$protectedVms.Where( { $_.VmName -like $machine }) | Select-Object -ExpandProperty VmIdentifier
|
||||
} else {
|
||||
Write-Warning "Virtual Machine: '$machine' is not found in Vpg: '$VpgName'. Check your parameters. Skipping $machine"
|
||||
}
|
||||
}
|
||||
if ($VmIdentifiers.Count -gt 0 -and $PSCmdlet.ShouldProcess(($Vm | Select-Object -Unique), "Removing VM(s): $($Vm | Select-Object -Unique) from Vpg $VpgName")) {
|
||||
$vpgSettingsIdentifier = New-ZertoVpgSettingsIdentifier -vpgIdentifier $VpgData.VpgIdentifier
|
||||
foreach ($identifier in $VmIdentifiers) {
|
||||
$url = "vpgSettings/{0}/vms/{1}" -f $vpgSettingsIdentifier, $identifier
|
||||
Invoke-ZertoRestRequest -uri $url -method DELETE
|
||||
}
|
||||
Save-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsIdentifier
|
||||
} else {
|
||||
Write-Warning "No VMs found to remove. Please check your parameters and try again."
|
||||
}
|
||||
}
|
||||
|
||||
end {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@ function Save-ZertoVpgSetting {
|
||||
ValueFromPipelineByPropertyName = $true
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Alias("vpgSettingsId")]
|
||||
[Alias("sid", "settingsIdentifier", "vpgSettingsId")]
|
||||
[string]$vpgSettingsIdentifier
|
||||
)
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function Set-ZertoLicense {
|
||||
}
|
||||
|
||||
process {
|
||||
if ($PSCmdlet.ShouldProcess()) {
|
||||
if ($PSCmdlet.ShouldProcess("Applying License Key: $licenseKey to server: $($script:zvmServer)")) {
|
||||
Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "PUT"
|
||||
}
|
||||
}
|
||||
|
||||
+55
-89
@@ -11,6 +11,7 @@ trigger:
|
||||
include:
|
||||
- master
|
||||
- PowerShellBackPort
|
||||
- Refactor-Build
|
||||
|
||||
# Trigger CI on pull requests to master and develop branches
|
||||
pr:
|
||||
@@ -24,26 +25,18 @@ jobs:
|
||||
pool:
|
||||
vmImage: windows-latest
|
||||
steps:
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- powershell: |
|
||||
.\build.ps1 -Verbose
|
||||
displayName: 'Build and Test'
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/SourceTestResults.xml'
|
||||
testRunTitle: 'PS_Win2016_Source'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/BuiltTestResults.xml'
|
||||
testRunTitle: 'PS_Win2016_Built'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- powershell: |
|
||||
.\build.ps1 -Verbose
|
||||
displayName: "Build and Test"
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: "NUnit"
|
||||
testResultsFiles: "**/BuiltTestResults.xml"
|
||||
testRunTitle: "PS_Win2016_Built"
|
||||
displayName: "Publish Test Results"
|
||||
condition: always()
|
||||
|
||||
# Windows PowerShell Core Build Job
|
||||
- job: Build_PSCore_Windows
|
||||
@@ -52,25 +45,18 @@ jobs:
|
||||
pool:
|
||||
vmImage: windows-latest
|
||||
steps:
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- pwsh: |
|
||||
.\build.ps1 -Verbose
|
||||
displayName: 'Build and Test'
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/SourceTestResults.xml'
|
||||
testRunTitle: 'PSCore_Win2016_Source'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/BuiltTestResults.xml'
|
||||
testRunTitle: 'PSCore_Win2016_Built'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- pwsh: |
|
||||
.\build.ps1 -Verbose
|
||||
displayName: "Build and Test"
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: "NUnit"
|
||||
testResultsFiles: "**/BuiltTestResults.xml"
|
||||
testRunTitle: "PSCore_Win2016_Built"
|
||||
displayName: "Publish Test Results"
|
||||
condition: always()
|
||||
|
||||
# Linux Build Job
|
||||
- job: Build_PSCore_Ubuntu
|
||||
@@ -79,37 +65,24 @@ jobs:
|
||||
pool:
|
||||
vmImage: ubuntu-latest
|
||||
steps:
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- pwsh: |
|
||||
.\build.ps1 -verbose
|
||||
displayName: 'Build and Test'
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/SourceTestResults.xml'
|
||||
testRunTitle: 'PSCore_Ubuntu_Source'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/BuiltTestResults.xml'
|
||||
testRunTitle: 'PSCore_Ubuntu_Built'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish compiled module Artifact'
|
||||
inputs:
|
||||
artifactName: 'ZertoApiWrapper'
|
||||
targetPath: ./temp
|
||||
condition: always()
|
||||
- task: PublishPipelineArtifact@0
|
||||
displayName: 'Publish Data'
|
||||
inputs:
|
||||
artifactName: 'ReleaseData'
|
||||
targetPath: ./publish
|
||||
condition: always()
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- pwsh: |
|
||||
.\build.ps1 -verbose
|
||||
displayName: "Build and Test"
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: "NUnit"
|
||||
testResultsFiles: "**/BuiltTestResults.xml"
|
||||
testRunTitle: "PSCore_Ubuntu_Built"
|
||||
displayName: "Publish Test Results"
|
||||
condition: always()
|
||||
- task: PublishPipelineArtifact@1
|
||||
displayName: "Publish Data"
|
||||
inputs:
|
||||
artifactName: "ReleaseData"
|
||||
targetPath: ./publish
|
||||
condition: always()
|
||||
|
||||
# MacOS Build Job
|
||||
- job: Build_PSCore_MacOS
|
||||
@@ -118,22 +91,15 @@ jobs:
|
||||
pool:
|
||||
vmImage: macOS-latest
|
||||
steps:
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- pwsh: |
|
||||
.\build.ps1 -verbose
|
||||
displayName: 'Build and Test'
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/SourceTestResults.xml'
|
||||
testRunTitle: 'PSCore_MacOS1013_Source'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: 'NUnit'
|
||||
testResultsFiles: '**/BuiltTestResults.xml'
|
||||
testRunTitle: 'PSCore_MacOS1013_Built'
|
||||
displayName: 'Publish Test Results'
|
||||
condition: always()
|
||||
# Run build.ps1 script in PowerShell Core
|
||||
- pwsh: |
|
||||
.\build.ps1 -verbose
|
||||
displayName: "Build and Test"
|
||||
# Upload test results to Azure Pipeline
|
||||
- task: PublishTestResults@2
|
||||
inputs:
|
||||
testRunner: "NUnit"
|
||||
testResultsFiles: "**/BuiltTestResults.xml"
|
||||
testRunTitle: "PSCore_MacOS1013_Built"
|
||||
displayName: "Publish Test Results"
|
||||
condition: always()
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
param([validateSet("build", "release")]$operation = "build")
|
||||
|
||||
# Bootstrap the environment
|
||||
$null = Get-PackageProvider -Name NuGet -ForceBootstrap
|
||||
|
||||
@@ -11,6 +13,7 @@ Invoke-PSDepend `
|
||||
-Force `
|
||||
-Import `
|
||||
-Install `
|
||||
-Tags 'Bootstrap'
|
||||
-Tags 'Bootstrap' `
|
||||
-ErrorAction Continue
|
||||
|
||||
Invoke-Build .
|
||||
Invoke-Build $operation
|
||||
|
||||
@@ -31,10 +31,10 @@ Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP addre
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -token "GeneratedFromTargetZVM"
|
||||
PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -targetPort "9071" -token "GeneratedFromTargetZVM"
|
||||
```
|
||||
|
||||
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later.
|
||||
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100 over Port 9071. Use this method when pairing Zerto Virtual Managers that are version 7.5 or later.
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Add-ZertoVpgVm.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Add-ZertoVpgVm
|
||||
|
||||
## SYNOPSIS
|
||||
Adds one or more virtual machines to an existing VPG. A VPG Settings Identifier will be returned for use in either further customization of the VPG or passed to the `Save-ZertoVpgSetting` command to commit the changes.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### VpgName (Default)
|
||||
```
|
||||
Add-ZertoVpgVm -VpgName <String> -Vm <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### VpgSettingsIdentifier
|
||||
```
|
||||
Add-ZertoVpgVm -vpgSettingsIdentifier <String> -Vm <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Adds one or more virtual machines to an existing VPG. A VPG Settings Identifier will be returned for use in either further customization of the VPG or passed to the `Save-ZertoVpgSetting` command to commit the changes.
|
||||
|
||||
Internal logic to the function will only process unique items and ensure that VMs meet requirements to replicate to the target site. These requirements include not currently a member of the specified VPG, not currently replicating to the target site, and not a member of 3 or more VPGs.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Add-ZertoVpgVm -VpgSettingsIdentifier $vpgSettingsIdentifier -Vm "VM 1", "Vm 2"
|
||||
```
|
||||
|
||||
Adds "VM 1" and "VM 2" to the Vpg with VpgSettingsIdentifer specified in `$VpgSettingsIdentifier`. This variable was obtained via other functions that create and return a Vpg Settings Identifier. The Vpg Settings Identifier passed into the function will be returned.
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Add-ZertoVpgVm -VpgName "My Vpg" -Vm "VM 1", "Vm 2"
|
||||
```
|
||||
|
||||
Adds "VM 1" and "VM 2" to the Vpg named "My Vpg". In this case, a new Vpg Settings Identifier will be created and returned.
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Vm
|
||||
Name of VM(s) to add to the VPG
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VpgName
|
||||
Target VPG Name to Add the VM
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: VpgName
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgSettingsIdentifier
|
||||
Vpg Settings Identifier
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: VpgSettingsIdentifier
|
||||
Aliases: sid, settingsIdentifier, vpgSettingsId
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### System.String
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
[Adding VMs to a VPG Settings Object](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vpg_management_api.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____20#statusapis_4057192544_1358357)
|
||||
+135
-112
@@ -1,112 +1,135 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Connect-ZertoServer.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Connect-ZertoServer
|
||||
|
||||
## SYNOPSIS
|
||||
Establishes a connection to a ZVM.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Connect-ZertoServer [-zertoServer] <String> [[-zertoPort] <String>] [-credential] <PSCredential>
|
||||
[-returnHeaders] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Establishes a connection to a ZVM using credentials provided via a PSCredential Object leveraging the Zerto Session API end point.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential
|
||||
```
|
||||
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object.
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -credential
|
||||
Valid credentials to connect to the Zerto Management Server
|
||||
|
||||
```yaml
|
||||
Type: PSCredential
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -returnHeaders
|
||||
Use this switch to return the headers to a specified variable or to the default output.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -zertoPort
|
||||
Zerto Virtual Manager management port.
|
||||
Default value is 9669.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases: port
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: "9669"
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -zertoServer
|
||||
IP address or FQDN of your Zerto Management Server
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases: server, zvm
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
[Zerto REST API Session End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.068.html%23)
|
||||
|
||||
[PSCredential Documentation](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential?view=pscore-6.0.0)
|
||||
|
||||
[Get-Credential Documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-6)
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Connect-ZertoServer.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Connect-ZertoServer
|
||||
|
||||
## SYNOPSIS
|
||||
Establishes a connection to a ZVM.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Connect-ZertoServer [-zertoServer] <String> [-credential] <PSCredential> [-zertoPort <String>] [-AutoReconnect]
|
||||
[-returnHeaders] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Establishes a connection to a ZVM using credentials provided via a PSCredential Object leveraging the Zerto Session API end point.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential
|
||||
```
|
||||
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object.
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Connect-ZertoServer -zertoServer "192.168.1.100" -zertoPort "9669" -credential $credential -AutoReconnect
|
||||
```
|
||||
|
||||
Establishes a connection to ZVM 192.168.1.100 on port 9669 with supplied PSCredential object. Adding the `-AutoReconnect` switch
|
||||
will cache the PSCredential object should the session need to be reauthorized due to an expired token.
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -AutoReconnect
|
||||
Use this switch to indicate that you would like the module to take care of auto re-authorization and reconnection to the ZVM should the token expire. This option will cache your PSCredential object to be reused
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -credential
|
||||
Valid credentials to connect to the Zerto Management Server
|
||||
|
||||
```yaml
|
||||
Type: PSCredential
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -returnHeaders
|
||||
Use this switch to return the headers to a specified variable or to the default output.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -zertoPort
|
||||
Zerto Virtual Manager management port.
|
||||
Default value is 9669.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases: port
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: "9669"
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -zertoServer
|
||||
IP address or FQDN of your Zerto Management Server
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases: server, zvm
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
[Zerto REST API Session End Point Documentation](http://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20%28ZVM%29%20-%20vSphere%20Online%20Help/index.html#page/RestfulAPIs%2FStatusAPIs.5.068.html%23)
|
||||
|
||||
[PSCredential Documentation](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential?view=pscore-6.0.0)
|
||||
|
||||
[Get-Credential Documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-6)
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoAzureResource.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Get-ZertoAzureResource
|
||||
|
||||
## SYNOPSIS
|
||||
Function used to get data for the Azure site to populate VPGs targeting Azure. This information includes Networks (VNets), Subnets, Security Groups, and VM Instance Types.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### SiteNameVmInstanceType (Default)
|
||||
```
|
||||
Get-ZertoAzureResource -SiteName <String> [-VmInstanceType] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteNameNetwork
|
||||
```
|
||||
Get-ZertoAzureResource -SiteName <String> [-Network] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteNameSubnet
|
||||
```
|
||||
Get-ZertoAzureResource -SiteName <String> [-Subnet] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteNameSecurityGroup
|
||||
```
|
||||
Get-ZertoAzureResource -SiteName <String> [-SecurityGroup] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteIdentifierVmInstanceType
|
||||
```
|
||||
Get-ZertoAzureResource -SiteIdentifier <String> [-VmInstanceType] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteIdentifierNetwork
|
||||
```
|
||||
Get-ZertoAzureResource -SiteIdentifier <String> [-Network] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteIdentifierSubnet
|
||||
```
|
||||
Get-ZertoAzureResource -SiteIdentifier <String> [-Subnet] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### SiteIdentifierSecurityGroup
|
||||
```
|
||||
Get-ZertoAzureResource -SiteIdentifier <String> [-SecurityGroup] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Function used to get data for the Azure site to populate VPGs targeting Azure. This information includes Networks (VNets), Subnets, Security Groups, and VM Instance Types.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -Network
|
||||
```
|
||||
|
||||
Returns information about the usable Networks (Vnets) at the Azure site with Zerto ZCA site named "My Azure Site"
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -Subnet
|
||||
```
|
||||
|
||||
Returns information about the usable Subnets at the Azure site with Zerto ZCA site named "My Azure Site"
|
||||
|
||||
### Example 3
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -SecurityGroup
|
||||
```
|
||||
|
||||
Returns information about the usable Security Groups at the Azure site with Zerto ZCA site named "My Azure Site"
|
||||
|
||||
### Example 4
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteName "My Azure Site" -VmInstanceType
|
||||
```
|
||||
|
||||
Returns information about the usable Vm Instance Types at the Azure site with Zerto ZCA site named "My Azure Site"
|
||||
|
||||
### Example 5
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -Network
|
||||
```
|
||||
|
||||
Returns information about the usable Networks (Vnets) at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
|
||||
|
||||
### Example 6
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -Subnet
|
||||
```
|
||||
|
||||
Returns information about the usable Subnets at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
|
||||
|
||||
### Example 7
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -SecurityGroup
|
||||
```
|
||||
|
||||
Returns information about the usable Security Groups at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
|
||||
|
||||
### Example 8
|
||||
```powershell
|
||||
PS C:\> Get-ZertoAzureResource -SiteIdentifier "0123-4142-152414" -VmInstanceType
|
||||
```
|
||||
|
||||
Returns information about the usable Vm Instance Types at the Azure site with Zerto ZCA site with identifier "0123-4142-152414"
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Network
|
||||
Use this switch to get information about the supported Networks (VNets).
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: SiteNameNetwork, SiteIdentifierNetwork
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -SecurityGroup
|
||||
Use this switch to get information about the supported Security Groups
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: SiteNameSecurityGroup, SiteIdentifierSecurityGroup
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -SiteIdentifier
|
||||
Site Identifier of the Azure Site you wish to get the information.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: SiteIdentifierVmInstanceType, SiteIdentifierNetwork, SiteIdentifierSubnet, SiteIdentifierSecurityGroup
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -SiteName
|
||||
Name the Azure Site you wish to get the information.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: SiteNameVmInstanceType, SiteNameNetwork, SiteNameSubnet, SiteNameSecurityGroup
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Subnet
|
||||
Use this switch to get information about the supported Subnets
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: SiteNameSubnet, SiteIdentifierSubnet
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VmInstanceType
|
||||
Use this switch to get information about the supported Vm Instance Types.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: SiteNameVmInstanceType, SiteIdentifierVmInstanceType
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
[ZVM Azure Resource API Endpoint Documentation](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/virtualization_sites_api.htm#Availabl)
|
||||
+22
-8
@@ -19,7 +19,7 @@ Get-ZertoEvent [<CommonParameters>]
|
||||
|
||||
### filter
|
||||
```
|
||||
Get-ZertoEvent [-startDate <String>] [-endDate <String>] [-vpgName <String>] [-vpgIdentifier <String>]
|
||||
Get-ZertoEvent [-startDate <String>] [-endDate <String>] [-vpg <String>] [-vpgIdentifier <String>]
|
||||
[-eventType <String>] [-siteName <String>] [-siteIdentifier <String>] [-zorgIdentifier <String>]
|
||||
[-entityType <String>] [-userName <String>] [-category <String>] [-eventCategory <String>]
|
||||
[-alertIdentifier <String>] [<CommonParameters>]
|
||||
@@ -66,13 +66,27 @@ PS C:\> Get-ZertoEvent -eventId "Need an eventID"
|
||||
|
||||
Returns information for each -eventID specified.
|
||||
|
||||
### Example 1
|
||||
### Example 3
|
||||
```powershell
|
||||
PS C:\> Get-ZertoEvent -startDate "2019-01-01" -endDate "2019-01-07" -vpg "My Vpg"
|
||||
```
|
||||
|
||||
Returns all events between Jan. 01, 2019 and Jan. 07, 2019 (inclusive) for the vpg "My Vpg"
|
||||
|
||||
### Example 4
|
||||
```powershell
|
||||
PS C:\> Get-ZertoEvent -userName "Domain.tld\MyUser
|
||||
```
|
||||
|
||||
Returns all events associated with the username passed into the command.
|
||||
|
||||
### Example 5
|
||||
```powershell
|
||||
PS C:\> Get-ZertoEvent -startDate "2019-01-01T12:30:00" -endDate "2019-01-01T13:30:00" -vpg "My Vpg"
|
||||
```
|
||||
|
||||
Returns all events between Jan. 01, 2019 12:30 PM and Jan. 01, 2019 1:30 PM (inclusive) for the vpg "My Vpg"
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -alertIdentifier
|
||||
@@ -295,13 +309,13 @@ Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgIdentifier
|
||||
The identifier of the VPG for which you want to return events.
|
||||
### -vpg
|
||||
The name of the VPG for which you want to return events.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: filter
|
||||
Aliases: vpgId
|
||||
Aliases: vpgName
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
@@ -310,13 +324,13 @@ Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgName
|
||||
The name of the VPG for which you want to return events.
|
||||
### -vpgIdentifier
|
||||
The identifier of the VPG for which you want to return events.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: filter
|
||||
Aliases: vpg
|
||||
Aliases: vpgId
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
|
||||
+62
-25
@@ -12,23 +12,30 @@ Start a move of a VPG.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### main (Default)
|
||||
### id (Default)
|
||||
```
|
||||
Invoke-ZertoMove [-vpgName] <String[]> [[-commitPolicy] <String>] [[-commitPolicyTimeout] <Int32>]
|
||||
[-forceShutdown] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Invoke-ZertoMove -vpgIdentifier <Guid[]> [-forceShutdown] [-disableReverseProtection] [-keepSourceVms]
|
||||
[-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### disableReverseProtection
|
||||
### commitName
|
||||
```
|
||||
Invoke-ZertoMove [-vpgName] <String[]> [[-commitPolicy] <String>] [[-commitPolicyTimeout] <Int32>]
|
||||
[-forceShutdown] [-disableReverseProtection] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
|
||||
Invoke-ZertoMove -vpgName <String[]> -commitPolicy <String> [-commitPolicyTimeout <Int32>] [-forceShutdown]
|
||||
[-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
### keepSourceVms
|
||||
### name
|
||||
```
|
||||
Invoke-ZertoMove [-vpgName] <String[]> [[-commitPolicy] <String>] [[-commitPolicyTimeout] <Int32>]
|
||||
[-forceShutdown] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Invoke-ZertoMove -vpgName <String[]> [-forceShutdown] [-disableReverseProtection] [-keepSourceVms]
|
||||
[-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### commitId
|
||||
```
|
||||
Invoke-ZertoMove -vpgIdentifier <Guid[]> -commitPolicy <String> [-commitPolicyTimeout <Int32>] [-forceShutdown]
|
||||
[-disableReverseProtection] [-keepSourceVms] [-ContinueOnPreScriptFailure] [-WhatIf] [-Confirm]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
@@ -38,10 +45,24 @@ Start a move of a VPG.
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Invoke-ZertoMove -vpgName "MyVpg"
|
||||
PS C:\> Invoke-ZertoMove -vpgName 'MyVpg'
|
||||
```
|
||||
|
||||
Starts a move operation of VPG "MyVpg"
|
||||
Specify the name of a vpg to move
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Invoke-ZertoMove -vpgIdentifier '2fbbf6b5-cddc-4653-b1fe-564f069eeb64'
|
||||
```
|
||||
|
||||
Specify the identifier of a vpg to move
|
||||
|
||||
### Example 3
|
||||
```powershell
|
||||
PS C:\> Get-ZertoVpg | Invoke-ZertoMove
|
||||
```
|
||||
|
||||
Utilize the pipeline to move multiple vpgs
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
@@ -56,11 +77,12 @@ Default is the Site Settings setting.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Parameter Sets: commitName, commitId
|
||||
Aliases:
|
||||
Accepted values: Rollback, Commit, None
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -72,11 +94,11 @@ If omitted, the site settings default will be applied.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Parameter Sets: commitName, commitId
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -91,7 +113,7 @@ Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 6
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -102,10 +124,10 @@ Do not enable reverse protection. The VPG definition is kept with the status Nee
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: disableReverseProtection
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
@@ -121,7 +143,7 @@ Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
@@ -132,13 +154,28 @@ Use this switch to Prevent the protected virtual machines from being deleted in
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: keepSourceVms
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -vpgIdentifier
|
||||
ID(s) of the VPG(s) you want to move.
|
||||
|
||||
```yaml
|
||||
Type: Guid[]
|
||||
Parameter Sets: id, commitId
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 5
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept pipeline input: True (ByPropertyName)
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
@@ -147,11 +184,11 @@ Name(s) of the VPG(s) you want to move.
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Parameter Sets: commitName, name
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoAzureVpg.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# New-ZertoAzureVpg
|
||||
|
||||
## SYNOPSIS
|
||||
Creates a New VPG Settings object targeting an Azure ZCA. A Zerto VPG Settings Identifier will be returned to as the VPG will need to be updated with the Virtual Machines that will be members of this VPG.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
New-ZertoAzureVpg [-Name] <String> [[-Priority] <String>] [[-JournalHistoryInHours] <Int32>]
|
||||
[[-RpoInSeconds] <Int32>] [[-TestIntervalInMinutes] <Int32>] [[-UseWanCompression] <Boolean>]
|
||||
[-TargetSiteName] <String> [-LiveNetworkName] <String> [-LiveSubnetName] <String>
|
||||
[-LiveSecurityGroupName] <String> [-LiveInstanceType] <String> [[-LiveDiskType] <String>]
|
||||
[-TestNetworkName] <String> [-TestSubnetName] <String> [-TestSecurityGroupName] <String>
|
||||
[-TestInstanceType] <String> [[-TestDiskType] <String>] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Creates a New VPG Settings object targeting an Azure ZCA. A Zerto VPG Settings Identifier will be returned to as the VPG will need to be updated with the Virtual Machines that will be members of this VPG.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> $VpgSettingsIdentifier = New-ZertoAzureVpg -Name "Example VPG" -Priority "Medium" -JournalHistoryInHours 24 -RpoInSeconds 300 -TestIntervalInMinutes 262080 -UseWanCompression $True -targetSiteName "My Azure Site" -liveNetworkName "Vnet_EastUS_Prod" -liveSubnetName "EUS-Subnet-1" -liveSecurityGroupName "SGP_East_Us_Prod" -LiveInstanceType "Standard_DS1_v2" -liveDiskType "ManagedPremiumSSD" -testNetworkName "Vnet_EastUS_Test" -testSubnetName "EUS-Subnet-2" -testSecurityGroupName "SGP_East_Us_Test" -testInstanceType "Standard_DS1_v2" -testDiskType "ManagedPremiumSSD"
|
||||
```
|
||||
|
||||
Creates a VPG with the specified settings returning a Vpg Settings Identifier to the specified variable to be used in later steps creating the Vpg. All parameters are specified in this example.
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> $VpgSettingsIdentifier = New-ZertoAzureVpg -Name "Example VPG" -targetSiteName "My Azure Site" -liveNetworkName "Vnet_EastUS_Prod" -liveSubnetName "EUS-Subnet-1" -liveSecurityGroupName "SGP_East_Us_Prod" -LiveInstanceType "Standard_DS1_v2" -testNetworkName "Vnet_EastUS_Test" -testSubnetName "EUS-Subnet-2" -testSecurityGroupName "SGP_East_Us_Test" -testInstanceType "Standard_DS1_v2"
|
||||
```
|
||||
|
||||
Creates a VPG with the specified settings returning a Vpg Settings Identifier to the specified variable to be used in later steps creating the Vpg. Only mandatory parameters are specified in this example.
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -JournalHistoryInHours
|
||||
Desired journal history in hours of the VPG to be created.
|
||||
Min 1 hour, Max 720 hours (30 days).
|
||||
Default is 24 hours.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 2
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LiveDiskType
|
||||
Type of disk to select as the default for the VPG during a live operation.
|
||||
Default is 'ManagedPremiumSSD'
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: UnmanagedStandard, ManagedPremiumSSD, ManagedStandardSSD, ManagedStandardHDD
|
||||
|
||||
Required: False
|
||||
Position: 11
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LiveInstanceType
|
||||
Name of the default VM Instance Type to use during a live operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 10
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LiveNetworkName
|
||||
Name of the default Network (VNet) to use during a live operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 7
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LiveSecurityGroupName
|
||||
Name of the default Security Group to use during a live operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 9
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -LiveSubnetName
|
||||
Name of the default subnet to use during a live operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 8
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Name
|
||||
Desired name of the VPG to be created.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Priority
|
||||
Replication priority of the VPG to be created.
|
||||
Default value is 'Medium'
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: High, Medium, Low
|
||||
|
||||
Required: False
|
||||
Position: 1
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -RpoInSeconds
|
||||
Desired RPO alert value in seconds.
|
||||
Min 60 seconds, Max 86400 seconds (24 hours).
|
||||
Default is 300 seconds (5 minutes).
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TargetSiteName
|
||||
Name of the ZCA site for the VPG to target.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 6
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TestDiskType
|
||||
Type of disk to select as the default for the VPG during a live operation.
|
||||
Default is 'ManagedPremiumSSD'
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: UnmanagedStandard, ManagedPremiumSSD, ManagedStandardSSD, ManagedStandardHDD
|
||||
|
||||
Required: False
|
||||
Position: 16
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TestInstanceType
|
||||
Name of the default VM Instance Type to use during a test operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 15
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TestIntervalInMinutes
|
||||
Desired test interval in minutes.
|
||||
Please review documentation for values.
|
||||
Default is 262080 minutes (6 months).
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
Accepted values: 0, 43200, 131040, 262080, 394560, 525600
|
||||
|
||||
Required: False
|
||||
Position: 4
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TestNetworkName
|
||||
Name of the default Network (VNet) to use during a test operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 12
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TestSecurityGroupName
|
||||
Name of the default Security Group to use during a test operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 14
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TestSubnetName
|
||||
Name of the default subnet to use during a test operation.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 13
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UseWanCompression
|
||||
Turn on or off WAN compression.
|
||||
Recommended this setting is not turned off.
|
||||
Default is to leave WAN compression turned on.
|
||||
|
||||
```yaml
|
||||
Type: Boolean
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 5
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
|
||||
Vpg Settings Identifier
|
||||
|
||||
## NOTES
|
||||
|
||||
Please review the process and examples outlined in the [Wiki on GitHub](https://Need.ToAdd.link/To/Wiki) for full Vpg Creation workflow and required examples.
|
||||
|
||||
## RELATED LINKS
|
||||
|
||||
[Zerto Create Azure VPG Help Documentation](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vsphere_to_azure_vpg_management_apis.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____26)
|
||||
+12
-12
@@ -12,6 +12,16 @@ Creates a New VPG with default settings only. Customization of VM settings can b
|
||||
|
||||
## SYNTAX
|
||||
|
||||
### recoveryHostDatastore (Default)
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
-recoverySite <String> -recoveryHost <String> -datastore <String> -recoveryFolder <String>
|
||||
[-rpoInSeconds <Int32>] [-testIntervalInMinutes <Int32>] [-serviceProfile <String>]
|
||||
[-useWanCompression <Boolean>] [-zorg <String>] -recoveryNetwork <String> -testNetwork <String>
|
||||
[-journalDatastore <String>] [-journalHardLimitInMb <UInt64>] [-journalWarningThresholdInMb <UInt64>]
|
||||
[-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### recoveryClusterDatastoreCluster
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
@@ -42,16 +52,6 @@ New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <
|
||||
[-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### recoveryHostDatastore
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
-recoverySite <String> -recoveryHost <String> -datastore <String> -recoveryFolder <String>
|
||||
[-rpoInSeconds <Int32>] [-testIntervalInMinutes <Int32>] [-serviceProfile <String>]
|
||||
[-useWanCompression <Boolean>] [-zorg <String>] -recoveryNetwork <String> -testNetwork <String>
|
||||
[-journalDatastore <String>] [-journalHardLimitInMb <UInt64>] [-journalWarningThresholdInMb <UInt64>]
|
||||
[-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
### recoveryResourcePoolDatastoreCluster
|
||||
```
|
||||
New-ZertoVpg -vpgName <String> [-vpgPriority <String>] [-journalHistoryInHours <Int32>] -protectedVm <String[]>
|
||||
@@ -176,7 +176,7 @@ Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: recoveryClusterDatastore, recoveryHostDatastore, recoveryResourcePoolDatastore
|
||||
Parameter Sets: recoveryHostDatastore, recoveryClusterDatastore, recoveryResourcePoolDatastore
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
@@ -312,7 +312,7 @@ Name of the host where the VM(s) will be recovered.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: recoveryHostDatastoreCluster, recoveryHostDatastore
|
||||
Parameter Sets: recoveryHostDatastore, recoveryHostDatastoreCluster
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
|
||||
@@ -21,7 +21,7 @@ Remove-ZertoVpg -vpgidentifier <String[]> [-keepRecoveryVolumes] [-force] [-What
|
||||
|
||||
### vpgName
|
||||
```
|
||||
Remove-ZertoVpg [-vpgName] <String[]> [-keepRecoveryVolumes] [-force] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Remove-ZertoVpg -vpgName <String[]> [-keepRecoveryVolumes] [-force] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
@@ -122,7 +122,7 @@ Parameter Sets: vpgName
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
---
|
||||
external help file: ZertoApiWrapper-help.xml
|
||||
Module Name: ZertoApiWrapper
|
||||
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Resume-ZertoVpgVm.md
|
||||
schema: 2.0.0
|
||||
---
|
||||
|
||||
# Remove-ZertoVpgVm
|
||||
|
||||
## SYNOPSIS
|
||||
Removes one or more VMs from a specified VPG. A Task Identifier is returned to track progress.
|
||||
|
||||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-ZertoVpgVm -VpgName <String> -Vm <String[]> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
Removes one or more VMs from a specified VPG. A Task Identifier is returned to track progress. Internal logic will remove duplicate VM names from the list of VMs provided as well as ensure membership in the VPG specified prior to attempting to remove the VM from the VPG. Finally the VPG is saved to commit the changes. ChangeImpact is set to 'High' to get the confirmation prompt.
|
||||
|
||||
## EXAMPLES
|
||||
|
||||
### Example 1
|
||||
```powershell
|
||||
PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1'
|
||||
```
|
||||
|
||||
Removes 'Vm 1' from Vpg named 'My Vpg'
|
||||
|
||||
### Example 2
|
||||
```powershell
|
||||
PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1', 'Vm 2'
|
||||
```
|
||||
|
||||
Removes 'Vm 1' and 'Vm 2' from Vpg named 'My Vpg'.
|
||||
|
||||
### Example 3
|
||||
```powershell
|
||||
PS C:\> Remove-ZertoVpgVm -VpgName 'My Vpg' -Vm 'Vm 1', 'Vm 2' -Confirm:$False
|
||||
```
|
||||
|
||||
Removes 'Vm 1' and 'Vm 2' from Vpg named 'My Vpg' and bypasses the confirmation prompt
|
||||
|
||||
## PARAMETERS
|
||||
|
||||
### -Vm
|
||||
Name of VM(s) to remove from the VPG
|
||||
|
||||
```yaml
|
||||
Type: String[]
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VpgName
|
||||
Name of the VPG that contains the VM you wish to remove
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Confirm
|
||||
Prompts you for confirmation before running the cmdlet.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: cf
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -WhatIf
|
||||
Shows what would happen if the cmdlet runs.
|
||||
The cmdlet is not run.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases: wi
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## INPUTS
|
||||
|
||||
### None
|
||||
|
||||
## OUTPUTS
|
||||
|
||||
### System.Object
|
||||
## NOTES
|
||||
|
||||
## RELATED LINKS
|
||||
[Remove Vms from a VPG Settings Object](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/zvr_apis/vpg_management_api.htm?tocpath=ZVR%20RESTful%20APIs%7CZerto%20APIs%7C_____20#statusapis_4057192544_1361409)
|
||||
@@ -36,10 +36,10 @@ VpgSettings Identifier to save
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases: vpgSettingsId
|
||||
Aliases: sid, settingsIdentifier, vpgSettingsId
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: True (ByPropertyName, ByValue)
|
||||
Accept wildcard characters: False
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
1.4.2
|
||||
1.5.1
|
||||
|
||||
Reference in New Issue
Block a user