149 Commits

Author SHA1 Message Date
Wes Carroll fe4d8cf4dd Merge pull request #75 from ZertoPublic/ReleasePrep
April Release
2020-04-10 08:14:00 -04:00
Wes Carroll e35939e592 Bump Version 2020-04-09 14:37:38 -04:00
Wes Carroll c422e26903 Update Readme for release 2020-04-09 14:37:27 -04:00
Wes Carroll e37444249e Merge pull request #74 from ZertoPublic/VirtulizationSiteRepos
Add functionality for ZVM 8.0
2020-04-09 13:27:35 -04:00
Wes Carroll 616cdcf7a2 Update Tests for WindowPS 2020-04-09 13:22:57 -04:00
Wes Carroll e7658fcfec Update the version of Pester to latest version 2020-04-09 13:22:42 -04:00
Wes Carroll a306391a14 Fix Filename Case 2020-04-09 12:55:41 -04:00
Wes Carroll 83e9551692 Add tests for function 2020-04-09 12:48:33 -04:00
Wes Carroll 7fbc550390 Add Mocks for Tests 2020-04-09 12:48:04 -04:00
Wes Carroll e3cba682c7 DRY Refactor 2020-04-09 10:37:36 -04:00
Wes Carroll 96b3e65be2 Update RELEASENOTES.md 2020-04-08 15:26:10 -04:00
Wes Carroll d15111a883 Add new LTR API Endpoint
Added new LTR endpoint and help messages to indicate that it will only work with Version 8.0 and above. Also updated help message for backup settings indicating that backup settings only work with 7.5 and below.
2020-04-08 15:19:46 -04:00
Wes Carroll 90434b56a2 Updated for new Repositories endpoint 2020-04-07 17:35:55 -04:00
Wes Carroll 85e60adac1 Merge pull request #73 from ZertoPublic/UpdateServiceAccountPassword
Create function to Update service account password
2020-04-07 10:44:00 -04:00
Wes Carroll 0d6bc39c86 Add an additional example 2020-04-07 10:30:42 -04:00
Wes Carroll ad2073f404 Fixed submitted body formatting 2020-04-07 10:27:22 -04:00
Wes Carroll e12bf9d85e Fix script level variable 2020-04-07 10:18:37 -04:00
Wes Carroll a5f3ad4de0 Update RELEASENOTES.md 2020-04-07 10:05:34 -04:00
Wes Carroll 77fb3c8f67 Fix helpmessage typo 2020-04-07 10:05:31 -04:00
Wes Carroll b2e5fe7b5c Update Set-ZertoUserCredential.md 2020-04-07 10:04:55 -04:00
Wes Carroll f34f21bb85 Create Set-ZertoUserCredential.md 2020-04-07 07:49:13 -04:00
Wes Carroll 536a62f792 Create Set-ZertoUserCredential.Tests.ps1 2020-04-06 17:15:57 -04:00
Wes Carroll df83277c06 Create Set-ZertoUserCredential.ps1 2020-04-06 17:15:52 -04:00
Wes Carroll d55bc3e4b3 Merge branch 'UpdateVraWithPassword' 2020-04-04 10:42:56 -04:00
Wes Carroll 7488e7999f Updated Release notes with current changes 2020-04-04 10:36:51 -04:00
Wes Carroll dcba2b04a9 Added Edit Password Information 2020-04-04 10:30:46 -04:00
Wes Carroll bd94bfe5db Update Help Files 2020-04-04 10:26:56 -04:00
Wes Carroll fb722661a7 Update Edit-ZertoVra.Tests.ps1 2020-04-03 16:51:09 -04:00
Wes Carroll 6121940563 Added ability to updated Host Password 2020-04-03 10:35:44 -04:00
Wes Carroll 64fa03e4ea Merge pull request #71 from ZertoPublic/ZA-Planner
Updates for Zerto Analytics
2020-04-02 19:57:38 -04:00
Wes Carroll 86854442ef Update Online Link to Help 2020-04-02 17:56:57 -04:00
Wes Carroll bc46a512cd Update RELEASENOTES.md 2020-04-02 17:55:04 -04:00
Wes Carroll 0a84246d8e Add parameter validation 2020-04-02 17:44:16 -04:00
Wes Carroll f299aecb9b Add parameter validation 2020-04-02 17:44:00 -04:00
Wes Carroll 646476e74e Remove unused parameter 2020-04-02 17:43:50 -04:00
Wes Carroll 285a82f280 Fix Parameter Test 2020-04-02 17:43:39 -04:00
Wes Carroll fbe9fb2af8 Fix Parameter Test 2020-04-02 17:43:28 -04:00
Wes Carroll 1af70b8c80 Create Tests 2020-04-02 17:38:35 -04:00
Wes Carroll 0ef71c25bb Update Get-ZAPlannerZcasReport.md 2020-04-02 17:16:14 -04:00
Wes Carroll 78e1cdb981 Update Get-ZAPlannerWanReport.md 2020-04-02 17:16:11 -04:00
Wes Carroll 1a66d4e64b Update Get-ZAPlannerStatsReport.md 2020-04-02 17:09:25 -04:00
Wes Carroll 2fef1dbc42 Create Get-ZAProtectedVmReport.md 2020-04-02 16:46:59 -04:00
Wes Carroll b00ededc7f Create Get-ZAProtectedVm.md 2020-04-02 16:44:08 -04:00
Wes Carroll 8e5ced9b87 Create Get-ZAProtectedVmReport.ps1 2020-04-02 15:12:52 -04:00
Wes Carroll 69fb384c89 Create Get-ZAProtectedVm.ps1 2020-04-02 15:12:43 -04:00
Wes Carroll a8b9ec3a00 Update Help File Formatting 2020-04-02 15:12:04 -04:00
Wes Carroll 355be7c1e5 Merge branch 'master' into ZA-Planner 2020-04-02 12:30:58 -04:00
Wes Carroll c94f04de77 Merge pull request #69 from ZertoPublic/MultiClusterSingleDatastore
Updates to Install-ZertoVra
2020-04-02 12:29:36 -04:00
Wes Carroll f4807f94fb Merge branch 'master' into MultiClusterSingleDatastore 2020-04-02 12:25:25 -04:00
Wes Carroll d39777cbb0 Merge pull request #70 from ZertoPublic/AzurePipelinesUpdates
Update build agents.
2020-04-02 12:22:14 -04:00
Wes Carroll 8b43856558 Update build agents. 2020-04-02 12:17:55 -04:00
Wes Carroll 83879a51e7 Update RELEASENOTES.md 2020-04-02 11:54:48 -04:00
Wes Carroll 2d1fb8e4db Update Install-ZertoVra.md 2020-04-02 10:51:05 -04:00
Wes Carroll e774cd861d Update Copy-ZertoVpg.md 2020-04-02 10:48:19 -04:00
Wes Carroll a660aa29b3 Update Common Parameters formatting 2020-04-02 10:48:02 -04:00
Wes Carroll 82458712f0 Update tests for new functionality 2020-04-02 10:46:40 -04:00
Wes Carroll bae9eb9b99 Update function to enable password installation 2020-04-02 10:27:20 -04:00
Wes Carroll 2ea7092b91 Update logic to only allow install to attached devices 2020-04-01 17:14:21 -04:00
Wes Carroll de08f0eece Ensure the right DSId is mapped to the target host. 2020-03-19 17:08:08 -04:00
Wes Carroll 3e980dc195 Add Online Help URI 2020-03-19 16:25:28 -04:00
Wes Carroll eccc5f27f3 Update Get-ZAPlannerNetworkPerformanceReport.md 2020-03-19 09:21:05 -04:00
Wes Carroll e516a24e38 Update Get-ZAPlannerJournalSizeReport.md 2020-03-19 09:19:48 -04:00
Wes Carroll 07f92583f8 Update Single Site URL 2020-03-18 13:57:12 -04:00
Wes Carroll c2f554dca1 Update Get-ZAPlannerSite.md 2020-03-18 13:54:58 -04:00
Wes Carroll 8bd865d83d Create Template Help Files 2020-03-08 22:45:51 -04:00
Wes Carroll 02e50d9cd6 Create Get-ZAPlannerZcasReport.ps1 2020-03-08 17:33:36 -04:00
Wes Carroll 7fc0a5f579 Create Get-ZAPlannerWanReport.ps1 2020-03-08 17:33:31 -04:00
Wes Carroll ce5a64c683 Create Get-ZAPlannerNetworkPerformanceReport.ps1 2020-03-08 17:33:27 -04:00
Wes Carroll 1317a6c039 Create Get-ZAPlannerJournalSizeReport.ps1 2020-03-08 17:33:24 -04:00
Wes Carroll 169e628c7b Remove Debugging Output 2020-03-08 14:57:19 -04:00
Wes Carroll d35d9d7cf4 Create Get-ZAPlannerStatsReport.ps1 2020-03-08 14:40:22 -04:00
Wes Carroll a891a4914d Create Get-ZAPlannerSite.ps1 2020-03-08 14:39:34 -04:00
Wes Carroll 71352cae7b Merge pull request #68 from ZertoPublic/IZRR-to-public
Move RestRequest functions into Public
2020-03-06 17:22:53 -05:00
Wes Carroll b0edd9026f Update RELEASENOTES.md 2020-03-06 14:08:12 -05:00
Wes Carroll 7cde687d70 Create Documentation for Newly Public Functions 2020-03-06 13:42:58 -05:00
Wes Carroll 569d9e264c Update ZertoRestRequest and associated Tests 2020-03-06 13:42:39 -05:00
Wes Carroll 40331c26f9 Update ZARestRequest and associated tests. 2020-03-06 13:42:20 -05:00
Wes Carroll 526093afc6 Fix the Tests extension 2020-03-06 13:31:59 -05:00
Wes Carroll dc4dd1ad05 Move IZRR function to public 2020-03-06 10:40:21 -05:00
Wes Carroll 779ee1415e Move IZRR to public 2020-03-06 10:38:41 -05:00
Wes Carroll 13592df6aa Move ZARestRequest to Public Function 2020-03-06 10:33:12 -05:00
Wes Carroll fad3ca0e27 Update RELEASENOTES.md 2020-03-06 10:01:17 -05:00
Wes Carroll 52782aa1e5 Merge pull request #67 from ZertoPublic/Refactor-GetVpg
Refactor Get-ZertoVpg
2020-03-06 09:11:10 -05:00
Wes Carroll bc02e796d6 Refactor for DRY 2020-03-05 21:43:52 -05:00
Wes Carroll 4c32bbe057 Update to PwSh Version 7 2020-03-05 21:43:32 -05:00
Wes Carroll cc9e53ac44 Merge branch 'fix-typos' 2020-03-02 10:30:12 -05:00
Wes Carroll 37165e18a7 Typo Correction Update 2020-03-02 10:00:45 -05:00
Wes Carroll 772848beef Updated help file to reflect typo correction 2020-03-02 09:53:55 -05:00
Wes Carroll 18185612bb Fixed recovery switch typo 2020-03-02 09:51:23 -05:00
Wes Carroll ecab2500c7 Merge pull request #65 from ZertoPublic/checkpoint-refactor
Checkpoint refactor
2020-03-02 09:46:34 -05:00
Wes Carroll fde7f67e45 Update RELEASENOTES.md 2020-03-02 09:41:09 -05:00
Wes Carroll e19f9b34f5 Update function to allow pipeline operations 2020-02-28 08:15:53 -05:00
Wes Carroll a36a7cb37a Cleanup documentation 2020-02-28 08:15:15 -05:00
Wes Carroll 1e80bb06fb Merge pull request #63 from ZertoPublic/ExportNicUpdate
Update Export and Import VpgNicSetting functions
2019-12-22 11:01:27 -05:00
Wes Carroll 4c98b75134 Update RELEASENOTES.md 2019-12-22 10:48:07 -05:00
Wes Carroll a7efc7c717 Merge branch 'master' into ExportNicUpdate 2019-12-22 10:37:44 -05:00
Wes Carroll 02f1c89d86 Merge pull request #62 from ZertoPublic/RecoveryReport
Remove -VpgIdentifier Parameter from Get-ZertoRecoveryReport function
2019-12-22 10:35:35 -05:00
Wes Carroll 5b9243a02f Updated releasenotes with changes 2019-12-22 10:16:27 -05:00
Wes Carroll 1962dda15c Remove vpgIdentifier Parameter
vpgIdentifier Parameter as added as a parameter by mistake. The API does not accecpt this as a filter.
2019-12-22 10:07:17 -05:00
Wes Carroll 801553178e Update Online Help Link 2019-12-20 22:56:20 -05:00
Wes Carroll 6c92dff447 Update Description with new logic 2019-12-20 22:56:04 -05:00
Wes Carroll 003396998c Eliminate Blank Output 2019-12-20 21:09:12 -05:00
Wes Carroll 05783a1f37 Update Import Logic 2019-12-19 18:49:13 -05:00
Wes Carroll 270470f858 Update Nic Object Logic 2019-12-18 13:06:11 -05:00
Wes Carroll 579ba7a063 Merge pull request #59 from ZertoPublic/PrepRelease
Prep release
2019-12-01 17:15:24 -05:00
Wes Carroll 2cb35165a9 Update README 2019-12-01 17:09:57 -05:00
Wes Carroll 82cf4cb732 Bump Version for Release 2019-12-01 17:05:53 -05:00
Wes Carroll 9d21eb6409 Format Release Notes 2019-12-01 17:05:40 -05:00
Wes Carroll abadc86ae8 Merge pull request #58 from ZertoPublic/FoT-Fix
Fixes Failover Test function
2019-12-01 17:01:53 -05:00
Wes Carroll f094263882 Update RELEASENOTES.md 2019-11-28 10:55:59 -05:00
Wes Carroll c47614727a Fix Verbose Typo 2019-11-28 10:41:26 -05:00
Wes Carroll 7cad7eaf75 Merge pull request #56 from ZertoPublic/CopyVpgBugFix
Fix Bug when Adding Additional VMs
2019-11-08 08:32:13 -05:00
Wes Carroll d6862f75d1 Fix Bug when Adding Additional VMs 2019-11-07 22:35:40 -05:00
Wes Carroll 5b8a89e1a3 Merge pull request #55 from ZertoPublic/CloneVPG
Implement Clone VPG Function
2019-11-07 21:45:27 -05:00
Wes Carroll d6562de9bf Update for Copy-ZertoVpg 2019-11-07 21:37:03 -05:00
Wes Carroll cdae203993 Fix Documentation Formatting 2019-11-07 17:44:06 -05:00
Wes Carroll 213b6029e4 Create Documentation 2019-11-07 17:43:40 -05:00
Wes Carroll 11ab03be0a Create Tests 2019-11-07 17:43:29 -05:00
Wes Carroll 5f978d7b1a Fix AddVM Logic 2019-11-07 17:43:18 -05:00
Wes Carroll 5c76c4c58c Merge pull request #53 from ZertoPublic/wcarroll-patch-1
Update Connect-ZertoServer.md
2019-11-04 16:20:49 -05:00
Wes Carroll 8b3a3b3b0b Update Connect-ZertoServer.md 2019-11-04 16:20:31 -05:00
Wes Carroll 63d56cf862 Merge branch 'CloneVPG' of https://github.com/wcarroll/ZertoApiWrapper into CloneVPG 2019-10-25 14:10:09 -04:00
Wes Carroll 10785df8a9 Create Copy-ZertoVpg Function 2019-10-25 14:09:00 -04:00
Wes Carroll 8a1593ceba Merge pull request #52 from ZertoPublic/EvacuateHost
Implement Evacuate VRA Function
2019-10-25 14:03:26 -04:00
Wes Carroll 1ca3d6704b Update Release Notes for Evacuate Function 2019-10-25 13:49:59 -04:00
Wes Carroll b4a7df970c Correct VraIdentifier Property 2019-10-24 13:51:26 -04:00
Wes Carroll 3d8acf03f6 Update Tests to include set counts 2019-10-24 13:50:52 -04:00
Wes Carroll 07de073bf1 Create Invoke-ZertoEvacuateVra.Tests.ps1 2019-10-24 07:25:38 -04:00
Wes Carroll 7641d28307 Add parameter validation 2019-10-23 10:00:42 -04:00
Wes Carroll 30422d0421 Create Invoke-ZertoEvacuateVra.md 2019-10-23 09:52:09 -04:00
Wes Carroll 4a0885f731 Fix Help Message Typo 2019-10-22 13:35:49 -04:00
Wes Carroll 28d66806a5 Add ExternalHelp Def 2019-10-22 13:31:10 -04:00
Wes Carroll 42b923cef5 Create EvacuateVra Function 2019-10-22 13:26:10 -04:00
Wes Carroll 5984bc93c9 Create Copy-ZertoVpg Function 2019-10-12 22:26:13 -04:00
Wes Carroll 528bc66bcd Merge pull request #49 from ZertoPublic/New-Token
Add Function to Obtain a Pairing Token
2019-10-08 12:45:15 -04:00
Wes Carroll e706470395 Add New-ZertoPairingToken to Release notes. 2019-10-08 12:37:11 -04:00
Wes Carroll 29a79bbb92 Correct extension case. 2019-10-08 12:31:34 -04:00
Wes Carroll f907acd14a Create New-ZertoPairingToken.md 2019-10-07 11:23:24 -04:00
Wes Carroll 90a17045af Create PairingToken.Json 2019-10-07 11:23:19 -04:00
Wes Carroll e1ba8412ff Create New-ZertoPairingToken.Tests.ps1 2019-10-07 11:23:13 -04:00
Wes Carroll 0a90d51735 Create New-ZertoPairingToken.ps1 2019-10-07 11:23:10 -04:00
Wes Carroll 9d34086e40 Merge pull request #48 from ZertoPublic/75Update
Update to add token parameter to Add-ZertoPeerSite
2019-10-04 17:01:37 -04:00
Wes Carroll 842c7ceeec Added release notes for this update. 2019-10-03 16:54:56 -04:00
Wes Carroll d78fc28b1c Add ShouldProcess support to help file. 2019-10-03 14:33:17 -04:00
Wes Carroll 28fb42d56a Update documentation for token parameter and example. 2019-10-03 14:33:01 -04:00
Wes Carroll 0657607f3a Update Tests to New format and add token parameter tests 2019-10-03 14:32:36 -04:00
Wes Carroll 32f6a6eebc Update function to use new token parameter 2019-10-03 14:32:05 -04:00
Wes Carroll 6cc2e8d61d Correct Example Number Typo 2019-09-04 15:45:17 -04:00
Wes Carroll b9598e7e0b Add Aug Release in recent updates. 2019-08-01 14:11:59 -04:00
130 changed files with 8573 additions and 4848 deletions
+1 -1
View File
@@ -4,5 +4,5 @@
"editor.insertSpaces": true, "editor.insertSpaces": true,
"editor.tabSize": 4, "editor.tabSize": 4,
"powershell.codeFormatting.preset": "OTBS", "powershell.codeFormatting.preset": "OTBS",
"terminal.integrated.shell.windows": "c:/Program Files/PowerShell/6/pwsh.exe" "terminal.integrated.shell.windows": "c:/Program Files/PowerShell/7/pwsh.exe"
} }
+4 -2
View File
@@ -4,8 +4,8 @@ PowerShell wrapper for Zerto Virtual Manager API
## Current Build Status ## Current Build Status
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/0e31e5cdad534271ac688a82cc3ca17d)](https://app.codacy.com/app/wcarroll/ZertoApiWrapper?utm_source=github.com&utm_medium=referral&utm_content=wcarroll/ZertoApiWrapper&utm_campaign=Badge_Grade_Settings)
[![Build Status](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_apis/build/status/ZertoPublic.ZertoApiWrapper?branchName=master)](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master) [![Build Status](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_apis/build/status/ZertoPublic.ZertoApiWrapper?branchName=master)](https://dev.azure.com/ZertoPublic/ZertoApiWrapper/_build/latest?definitionId=1&branchName=master)
![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/ZertoApiWrapper?label=PowerShell%20Gallery%20Downloads)
## Legal Disclaimer ## Legal Disclaimer
@@ -32,6 +32,9 @@ PS> Install-Module -name ZertoApiWrapper
## Recent Updates ## Recent Updates
* April 10th, 2020: April Release. See [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/1.4.0.20200410).
* December 1st, 2019: November Release. See [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/1.3.0.20191201).
* August 1st, 2019: August Release. See [Release Notes](https://github.com/ZertoPublic/ZertoApiWrapper/releases/tag/1.2.0.20190801).
* June 16th, 2019: Added functionality for Zerto Analytics. * June 16th, 2019: Added functionality for Zerto Analytics.
* May 31st, 2019: Implement logic to allow use of this module in both Windows PowerShell 5.1 and PowerShell Core. * May 31st, 2019: Implement logic to allow use of this module in both Windows PowerShell 5.1 and PowerShell Core.
* March 15th, 2019: Implement Export and Import Functionality. Please See [Export-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Export-ZertoVpg.md) and [Import-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVpg.md) for assistance. No current pre-seed support. * March 15th, 2019: Implement Export and Import Functionality. Please See [Export-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Export-ZertoVpg.md) and [Import-ZertoVpg Help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVpg.md) for assistance. No current pre-seed support.
@@ -39,7 +42,6 @@ PS> Install-Module -name ZertoApiWrapper
## TODO ## TODO
* Complete Help Markdown Files
* JFLR Functionality * JFLR Functionality
* Create VPG (Per-VM modification and Backup Settings) * Create VPG (Per-VM modification and Backup Settings)
* Edit VPG * Edit VPG
+23 -12
View File
@@ -2,17 +2,28 @@
### Zerto Virtual Manager ### Zerto Virtual Manager
* Added two functions to aid in bulk updating of NIC information for protected VMs. ([Issue 38](https://github.com/ZertoPublic/ZertoApiWrapper/issues/38)) * Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/60) in the `Get-ZertoRecoveryReport` function where the `-VpgIdentifier` parameter was not working. This parameter is not accepted by the API as a valid filter and is ignored. This parameter has been removed from the function.
* [Export-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Export-ZertoVmNicSettings.md) * Addressed a reported [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/61) where the `Export-ZertoVpgNicSetting` function would not properly execute when run against a VM with no NICs attached.
* [Import-ZertoVmNicSetting](https://github.com/ZertoPublic/ZertoApiWrapper/blob/Master/docs/Import-ZertoVmNicSettings.md) * In reviewing the `Export-ZertoVpgNicSetting`, a review of the `Import-ZertoVpgNicSetting` was completed and it was determined to update the import logic based on various test cases. Along with this, it is now possible to reset the NIC settings to the default state with the `Import-ZertoVpgNicSetting` command. Please review the [Import-ZertoVpgNicSetting help](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md) to review the updated options and import logic.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/43) where a VPG being created with a single VM member would not be parsed by the API correctly using PowerShell 5.1 * Refactored the `Checkpoint-ZertoVpg` command to allow pipeline input (ByValue and ByProperty) for the VpgName parameter.
* Corrected a parameter typo in the `Get-ZertoVpgSetting` function. The misspelt parameter was added as an alias to ensure any existing scripts using the parameter continue to function.
* Refactored the `Get-ZertoVpg` command to remove repetitive commands and variables that are no longer required.
* Moved `Invoke-ZertoRestRequest` and `Invoke-ZARestRequest` to be public functions. As there become more and more scenarios where there are not prebuilt functions to accomplish complex specialized tasks, it became apparent that these functions could be leveraged to make the experience and workflow easier.
* Updated the `Install-ZertoVra` logic to ensure that the target datastore is available on the target host. There isn't currently any method to validate the target network, but if that becomes available in a later version of the API, the function will be updated.
* Updated the `Install-ZertoVra` function to allow for installation of the VRA using the host password method. Please review the [Install-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Install-ZertoVra.md) documentation for syntax and examples.
* Updated the `Edit-ZertoVra` function to allow for modification of the associated ESX host password if the need arises. Please review the [Edit-ZertoVra](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Edit-ZertoVra.md) documentation for syntax and examples.
* Added a new function, `Set-ZertoUserCredential`, to allow the updating of the username and password used to connect the Zerto Virtual Manager to the paired hypervisor. Please see the [Set-ZertoUserCredential](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md) help for additional information.
* With the release of [Zerto 8.0](https://www.zerto.com/zerto-8-0-general-availability/) some additional API endpoints have become available.
* Updated `Get-ZertoVirtualizationSite` to add the `-repository` parameter to enable returning information for LTR repositories.
* Updated `Get-ZertoVpgSetting` to add the `-ltr` parameter to enable returning information for current LTR settings for the selected VPG.
### Zerto Analytics ### Zerto Analytics
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/36) where the Zerto Analytics Rest Request function was not checking for the token before attempting a connection. * Added several functions for the newly added [Zerto Analytics](https://analytics.zerto.com) Planner.
* Fixed an [issue](https://github.com/ZertoPublic/ZertoApiWrapper/issues/40) where the `Get-ZAVpg` method would return a 404 error when a `-vpgIdentifier` parameter was specified. * `Get-ZAPlannerSite` Help can be found here: [Get-ZAPlannerSite](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md)
* `Get-ZAPlannerStatsReport` Help can be found here: [Get-ZAPlannerStatsReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md)
### General Updates * `Get-ZAPlannerJournalSizeReport` Help can be found here: [Get-ZAPlannerJournalSizeReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md)
* `Get-ZAPlannerNetworkPerformanceReport` Help can be found here: [Get-ZAPlannerNetworkPerformanceReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md)
* Updated the way that tests are invoked and parsed to ensure that both source and built module files are tested. This will ensure that what is being shipped passes all tests along with testing of the source files. * `Get-ZAPlannerWanReport` Help can be found here: [Get-ZAPlannerWanReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md)
* Added additional parameter validation tests to several of the functions. On-going effort to complete stand alone unit testing of each function. * `Get-ZAPlannerZcasReport` Help can be found here: [Get-ZAPlannerZcasReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md)
* Created `Get-ZAProtectedVm` and `Get-ZAProtectedVmReport` functions to leverage the newly released Zerto Analytics APIs for this data. Help files can be found here: [Get-ZAProtectedVm](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md) and [Get-ZAProtectedVmReport](https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md)
+50 -22
View File
@@ -9,34 +9,55 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
It "Has a mandatory string parameter for the target host" { It "$global:function should have exactly 16 parameters defined" {
Get-Command $global:function | Should -HaveParameter TargetHost -Mandatory -Type String (Get-Command $global:function).Parameters.Count | Should -Be 16
} }
It "Will not take a non-ip address as a 'TargetHost'" { $ParameterTestCases = @(
{ Add-ZertoPeerSite -targetHost 'MyZVMHost' -targetPort '9081' } | Should -Throw @{ParameterName = 'targetHost'; Type = 'String'; Mandatory = $true; Validation = 'Script' }
{ Add-ZertoPeerSite -targetHost '192.168.1.266' -targetPort '9081' } | Should -Throw @{ParameterName = 'targetPort'; Type = 'Int32'; Mandatory = $false; Validation = 'Range' }
{ Add-ZertoPeerSite -targetHost '192.168.1' -targetPort '9081' } | Should -Throw @{ParameterName = 'token'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
{ Add-ZertoPeerSite -targetHost $null -targetPort '9081' } | Should -Throw )
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 "Has a non-mandatory string parameter for the target port with default value of 9081" { It "<ParameterName> parameter has correct validation setting" -TestCases $ParameterTestCases {
Get-Command Add-ZertoPeerSite | Should -HaveParameter TargetPort -Not -Mandatory param($ParameterName, $Validation)
Get-Command Add-ZertoPeerSite | Should -HaveParameter TargetPort -Type Int32 Switch ($Validation) {
Get-Command Add-ZertoPeerSite | Should -HaveParameter TargetPort -DefaultValue 9081 '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
}
'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 "Will not take a non-int as a port" { It "targetPort Parameter should have a default value of 9081" {
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 'string' } | Should -Throw Get-Command $global:function | Should -HaveParameter targetPort -DefaultValue 9081
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $true } | Should -Throw
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort $null } | Should -Throw
} }
It "Will fail if the specified port is outside of the range 1024 - 65535" { It "targetPort Parameter should have a Min value of 1024" {
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 1023 } | Should -Throw (Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MinRange | Should Be 1024
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 65536 } | Should -Throw }
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort 0 } | Should -Throw
{ Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort -1 } | Should -Throw It "targetPort Parameter should have a Max value of 65535" {
(Get-Command $global:function).Parameters['targetPort'].Attributes.Where{ $_ -is [ValidateRange] }.MaxRange | Should Be 65535
} }
It "Supports 'SupportsShouldProcess'" { It "Supports 'SupportsShouldProcess'" {
@@ -52,19 +73,26 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
return (Get-Content "$global:here\Mocks\TaskId.txt") return (Get-Content "$global:here\Mocks\TaskId.txt")
} }
It "Returns a string value" { It "Returns a string value when no Token Passed" {
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081'
$results | Should -Not -BeNullOrEmpty $results | Should -Not -BeNullOrEmpty
$results | Should -BeOfType "String" $results | Should -BeOfType "String"
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a" $results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
} }
It "Returns a string value when a Token is passed" {
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -token "NotARealTokenString"
$results | Should -Not -BeNullOrEmpty
$results | Should -BeOfType "String"
$results | Should -BeExactly "7e79035e-fb8c-47fe-815c-12ddd41708e6.3e4cdd0d-1064-4022-921f-6265ad6d335a"
}
It "Does not return a taskId if '-whatif' is used" { It "Does not return a taskId if '-whatif' is used" {
$results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -WhatIf $results = Add-ZertoPeerSite -targetHost '192.168.1.100' -targetPort '9081' -WhatIf
$results | Should -BeNullOrEmpty $results | Should -BeNullOrEmpty
} }
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 1 Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2
} }
} }
Remove-Variable -Name here -Scope Global Remove-Variable -Name here -Scope Global
+1 -1
View File
@@ -16,7 +16,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$($global:function)::Parameter Unit Tests" { Context "$($global:function)::Parameter Unit Tests" {
It "Has a parameter for the VpgName that is Mandatory" { It "Has a parameter for the VpgName that is Mandatory" {
Get-Command $global:function | Should -HaveParameter vpgName -Mandatory -Type String Get-Command $global:function | Should -HaveParameter vpgName -Mandatory -Type 'String[]'
} }
It "Has a parameter for the CheckpointName that is Mandatory" { It "Has a parameter for the CheckpointName that is Mandatory" {
+56
View File
@@ -0,0 +1,56 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).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 = 'SourceVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'NewVpgName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'VMs'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory)
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
}
$null {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.TypeId.Count | Should -Be 2
}
}
}
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 "$($global:function)::Function Unit Tests" {
}
}
Remove-Variable -Name function -Scope Global
Remove-Variable -Name here -Scope Global
+2 -1
View File
@@ -28,6 +28,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $false } @{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $false }
@{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $false } @{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $false }
@{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $false } @{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $false }
@{ParameterName = 'HostRootPassword'; Type = 'securestring'; Mandatory = $false}
) )
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases { It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
@@ -56,7 +57,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
param($ParameterName) param($ParameterName)
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '^\$_ \-match \[IPAddress\]\$_' $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
} }
} }
@@ -0,0 +1,57 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
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 = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; 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
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,57 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
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 = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'interval'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; 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
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+42
View File
@@ -0,0 +1,42 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 12 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 12
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String[]'; Mandatory = $false; 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"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,57 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
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 = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'desiredJournalHistory'; Type = 'Int'; Mandatory = $false; Validation = 'Range' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; 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
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,56 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 14 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 16
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; 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
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,56 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
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 = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'recoveryType'; Type = 'String'; Mandatory = $true; Validation = 'Set' }
@{ParameterName = 'startDate'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'endDate'; Type = 'String'; Mandatory = $false; 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
}
'Range' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateRange] }.Count | Should -Be 1
}
'Set' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateSet] }.Count | Should -Be 1
}
default {
$true | Should be $false -Because "No Validation Selected. Review test cases"
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+41
View File
@@ -0,0 +1,41 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 14 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 14
}
$ParameterTestCases = @(
@{ParameterName = 'AllVms'; Type = 'Switch'; Mandatory = $false; Validation = $Null }
@{ParameterName = 'vmIdentifier'; Type = 'String[]'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'Volumes'; Type = 'Switch'; Mandatory = $false; Validation = $Null }
)
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
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,39 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 12 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 12
}
$ParameterTestCases = @(
@{ParameterName = 'vmIdentifier'; 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
}
}
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -3,13 +3,257 @@ $global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0] $global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
BeforeAll {
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
}
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
It "$global:function should have exactly 23 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 23
}
$ParameterTestCases = @(
@{ParameterName = 'siteIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'hostIdentifier'; Type = 'String'; Mandatory = $false; Validation = 'NotNullOrEmpty' }
@{ParameterName = 'folders'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'hostClusters'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'hosts'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'networks'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'resourcePools'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'vms'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
@{ParameterName = 'repositories'; Type = 'Switch'; Mandatory = $true; Validation = $Null }
)
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Mandatory)
Get-Command $global:function | Should -HaveParameter $ParameterName -Mandatory:$Mandatory -Type $Type
}
It "<ParameterName> parameter has correct validation setting of <Validation>" -TestCases $ParameterTestCases {
param($ParameterName, $Type, $Validation)
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
Switch ($Validation) {
'NotNullOrEmpty' {
$attrs.Where{ $_ -is [ValidateNotNullOrEmpty] }.Count | Should -Be 1
}
$Null {
$Type -match 'Switch' | Should -BeTrue -Because "Only Switch Parameters should not have validation"
}
default {
$true | Should -BeFalse -Because "No Validation Selected. Review test cases"
}
}
}
It "$($global:function) does not have 'SupportsShouldProcess'" {
Get-Command $global:function | Should -not -HaveParameter WhatIf
Get-Command $global:function | Should -not -HaveParameter Confirm
$script:ScriptBlock | Should -not -match 'SupportsShouldProcess'
$script:ScriptBlock | Should -not -match '\$PSCmdlet\.ShouldProcess\(.+\)'
}
} }
Context "$global:function::Parameter Functional Tests" { Context "$global:function::Parameter Functional Tests" {
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-NoParams.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-devices.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-devices-hostid.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-hosts.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts/4567'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-hosts-hostid.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-SiteId.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastores'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-datastores.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastoreclusters'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-datastoreClusters.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/networks'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-Networks.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/folders'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-Folders.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hostclusters'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-hostClusters.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/resourcepools'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-ResourcePools.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/vms'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-VMs.json" -Raw) | ConvertFrom-Json
} -Verifiable
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/repositories'
} {
return (Get-Content "$global:here\Mocks\VirtualSite-repositories.json" -Raw) | ConvertFrom-Json
} -Verifiable
It "Should return all known sites when called without parameters" {
$results = Get-ZertoVirtualizationSite
$results.Count | Should -BeExactly 2
}
It "Should return a single site when a siteIdentifier is provided" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234'
$results.VirtualizationSiteName | Should -BeExactly 'cavc.nc.lab'
$results.siteIdentifier | Should -BeExactly '8e1c9f53-4973-4a4a-b2dd-1ebb293614d8'
}
It "Should return a list of devices with the '-devices' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices
$results.Count | Should -BeExactly 5
}
It "Should return a list of devices with the '-devices' switch and hostIdentifier provided" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -devices -hostIdentifier '4567'
$results.Count | Should -BeExactly 5
}
It "Should return a list of hosts with the '-hosts' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts
$results.Count | Should -BeExactly 3
}
It "Should return a single host with the '-hosts' switch and hostIdentifier provided" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hosts -hostIdentifier '4567'
$results.VirtualizationHostName | Should -BeExactly "caesx3.nc.lab"
$results.hostIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.host-18"
}
It "Should return a list of datastores with the '-datastores' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastores
$results.Count | Should -BeExactly 8
}
It "Should return a list of datastores with the '-datastoreClusters' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -datastoreClusters
$results.DatastoreClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.group-p44"
$results.DatastoreClusterName | Should -BeExactly "CA_DS_Cluster"
}
It "Should return a list of Networks with the '-networks' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -networks
$results.NetworkIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.network-20"
$results.VirtualizationNetworkName | Should -BeExactly "VM Network"
}
It "Should return a list of folders with the '-folders' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -folders
$results.Count | Should -BeExactly 3
}
It "Should return a list of Host Clusters with the '-hostClusters' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -hostClusters
$results.ClusterIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7"
$results.VirtualizationClusterName | Should -BeExactly "CA Cluster"
}
It "Should return a list of Resource Pools with the '-resourcePools' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -resourcePools
$results.ResourcePoolIdentifier | Should -BeExactly "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8"
$results.ResourcePoolName | Should -BeExactly "Resources"
}
It "Should return a list of VMs with the '-VMs' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -vms
$results.Count | Should -BeExactly 4
}
It "Should return a list of LTR Repositories with the '-repositories' switch" {
$results = Get-ZertoVirtualizationSite -siteIdentifier '1234' -repositories
$results.ConnectionType | Should -BeExactly "ServerMessageBlock"
$results.RepositoryIdentifier | Should -BeExactly "120355ce-fcd0-4820-a971-787d0470793b"
$results.RepositoryName | Should -BeExactly "Synology"
$results.StorageType | Should -BeExactly "NetworkShare"
$results.Path | Should -not -be $null
}
Assert-VerifiableMock
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/devices?hostIdentifier=4567'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hosts/4567'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastores'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/datastoreclusters'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/networks'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/folders'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/hostclusters'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/resourcepools'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/vms'
} -Exactly 1
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -ParameterFilter {
$uri -eq 'virtualizationsites/1234/repositories'
} -Exactly 1
} }
} }
+6 -4
View File
@@ -5,8 +5,8 @@ $global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[
Describe $global:function -Tag 'Unit', 'Source', 'Built' { Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Context "$global:function::Parameter Unit Tests" { Context "$global:function::Parameter Unit Tests" {
it "$global:function should have exactly 22 parameters defined" { It "$global:function should have exactly 24 parameters defined" {
(get-command $global:function).Parameters.Count | Should -Be 22 (Get-Command $global:function).Parameters.Count | Should -Be 24
} }
$ParameterTestCases = @( $ParameterTestCases = @(
@@ -17,6 +17,8 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } @{ParameterName = 'vraIpAddress'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
@{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } @{ParameterName = 'subnetMask'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
@{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' } @{ParameterName = 'defaultGateway'; Type = 'String'; Mandatory = $true; Validation = 'IpAddr' }
@{ParameterName = 'UseRootCredential'; Type = 'Switch'; Mandatory = $true; Validation = $null }
@{ParameterName = 'HostRootPassword'; Type = 'SecureString'; Mandatory = $true; Validation = 'NotNullOrEmpty' }
) )
It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases { It "<ParameterName> parameter is of <Type> type" -TestCases $ParameterTestCases {
@@ -35,12 +37,12 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
'IpAddr' { 'IpAddr' {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1 $attrs.Where{ $_ -is [ValidateScript] }.Count | Should -Be 1
$attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '^\$_ \-match \[IPAddress\]\$_' $attrs.Where{ $_ -is [ValidateScript] }.ScriptBlock | Should -Match '\$_ \-match \[IPAddress\]\$_'
} }
$null { $null {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes $attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.TypeId.Count | Should -Be 2 $attrs.TypeId.Count | Should -Be 3
} }
} }
} }
@@ -12,7 +12,6 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
@{ParameterName = 'uri'; Type = 'String'; Mandatory = $true; TestName = 'URI' } @{ParameterName = 'uri'; Type = 'String'; Mandatory = $true; TestName = 'URI' }
@{ParameterName = 'method'; Type = 'String'; Mandatory = $false; TestName = 'Method' } @{ParameterName = 'method'; Type = 'String'; Mandatory = $false; TestName = 'Method' }
@{ParameterName = 'body'; Type = 'String'; Mandatory = $false; TestName = 'Body' } @{ParameterName = 'body'; Type = 'String'; Mandatory = $false; TestName = 'Body' }
@{ParameterName = 'contentType'; Type = 'String'; Mandatory = $false; TestName = 'contentType' }
) )
It "Parameter present and Type test for: <TestName> " -TestCases $testCases { It "Parameter present and Type test for: <TestName> " -TestCases $testCases {
@@ -29,14 +28,9 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
Get-Command $global:function | Should -HaveParameter Method -DefaultValue "GET" Get-Command $global:function | Should -HaveParameter Method -DefaultValue "GET"
} }
It "ContentType parameter default is 'application/json'" {
Get-Command $global:function | Should -HaveParameter contentType -DefaultValue "application/json"
}
$NotNullOrEmptyTests = @( $NotNullOrEmptyTests = @(
@{ParameterName = 'uri'; TestName = 'Uri' } @{ParameterName = 'uri'; TestName = 'Uri' }
@{ParameterName = 'body'; TestName = 'Body' } @{ParameterName = 'body'; TestName = 'Body' }
@{ParameterName = 'contentType'; TestName = 'ContentType' }
) )
It "<TestName> parameter does not accecpt a null or empty value" -TestCases $NotNullOrEmptyTests { It "<TestName> parameter does not accecpt a null or empty value" -TestCases $NotNullOrEmptyTests {
@@ -0,0 +1,54 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
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 = 'hostName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty'; ParameterSet = @('hostName') }
@{ParameterName = 'vraName'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraName') }
@{ParameterName = 'vraIdentifier'; Type = 'String'; Mandatory = $true; Validation = 'NotNullOrEmpty' ; ParameterSet = @('vraIdentifier') }
)
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
}
$null {
$attrs = (Get-Command $global:function).Parameters[$ParameterName].Attributes
$attrs.TypeId.Count | Should -Be 2
}
}
}
It "<ParameterName> parameter is part of the correct ParameterSet(s)" -TestCases $ParameterTestCases {
param($ParameterName, $ParameterSet)
$commandParameterSets = (Get-Command $global:function).Parameters[$ParameterName].ParameterSets
foreach ($Set in $ParameterSet) {
$commandParameterSets.ContainsKey($Set) | Should -BeTrue
}
$commandParameterSets.Count | Should -Be $ParameterSet.Count
}
}
Context "$global:function::Parameter Functional Tests" {
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -14,9 +14,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterNameTestCases = @( $ParameterNameTestCases = @(
@{ParameterName = "uri"; Type = "String"; Mandatory = $true; DefaultValue = $null; TestName = "URI" } @{ParameterName = "uri"; Type = "String"; Mandatory = $true; DefaultValue = $null; TestName = "URI" }
@{ParameterName = "method"; Type = "String"; Mandatory = $false; DefaultValue = 'GET'; TestName = "Method" } @{ParameterName = "method"; Type = "String"; Mandatory = $false; DefaultValue = 'GET'; TestName = "Method" }
@{ParameterName = "apiVersion"; Type = "String"; Mandatory = $false; DefaultValue = 'v1'; TestName = "API Version" }
@{ParameterName = "body"; Type = "String"; Mandatory = $false; DefaultValue = $null; TestName = "Body" } @{ParameterName = "body"; Type = "String"; Mandatory = $false; DefaultValue = $null; TestName = "Body" }
@{ParameterName = "contentType"; Type = "String"; Mandatory = $false; DefaultValue = 'application/json'; TestName = "Content Type" }
@{ParameterName = "credential"; Type = "PSCredential"; Mandatory = $false; DefaultValue = $null; TestName = "Credential" } @{ParameterName = "credential"; Type = "PSCredential"; Mandatory = $false; DefaultValue = $null; TestName = "Credential" }
@{ParameterName = "returnHeaders"; Type = "Switch"; Mandatory = $false; DefaultValue = $null; TestName = "Return Headers" } @{ParameterName = "returnHeaders"; Type = "Switch"; Mandatory = $false; DefaultValue = $null; TestName = "Return Headers" }
) )
@@ -36,9 +34,7 @@ Describe $global:function -Tag 'Unit', 'Source', 'Built' {
$ParameterValidationTestCases = @( $ParameterValidationTestCases = @(
@{ParameterName = "URI"; TestName = "URI" } @{ParameterName = "URI"; TestName = "URI" }
@{ParameterName = "apiVersion"; TestName = "Api Version" }
@{ParameterName = "body"; TestName = "Body" } @{ParameterName = "body"; TestName = "Body" }
@{ParameterName = "contentType"; TestName = "Content Type" }
) )
It "<TestName> parameter cannot be null or empty" -TestCases $ParameterValidationTestCases { It "<TestName> parameter cannot be null or empty" -TestCases $ParameterValidationTestCases {
+4
View File
@@ -0,0 +1,4 @@
{
"Token": "TH15ISN0T4R3AL70KEN",
"UtcExpirationDate": "10/09/2019 12:55 PM"
}
@@ -0,0 +1,14 @@
[
{
"FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v3",
"FolderName": "/"
},
{
"FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v27",
"FolderName": "Templates"
},
{
"FolderIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-v9",
"FolderName": "Discovered virtual machine"
}
]
@@ -0,0 +1,4 @@
{
"NetworkIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.network-20",
"VirtualizationNetworkName": "VM Network"
}
@@ -0,0 +1,10 @@
[
{
"SiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8",
"VirtualizationSiteName": "cavc.nc.lab"
},
{
"SiteIdentifier": "15aa0d43-69cd-400a-8b99-fe94bbac3e19",
"VirtualizationSiteName": "ncvc.nc.lab"
}
]
@@ -0,0 +1,4 @@
{
"ResourcePoolIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.resgroup-8",
"ResourcepoolName": "Resources"
}
@@ -0,0 +1,4 @@
{
"SiteIdentifier": "8e1c9f53-4973-4a4a-b2dd-1ebb293614d8",
"VirtualizationSiteName": "cavc.nc.lab"
}
+18
View File
@@ -0,0 +1,18 @@
[
{
"VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-55",
"VmName": "TimeSeries"
},
{
"VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-53",
"VmName": "AnsibleTarget"
},
{
"VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-28",
"VmName": "cazvm.nc.lab"
},
{
"VmIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.vm-26",
"VmName": "WinTemplate"
}
]
@@ -0,0 +1,4 @@
{
"DatastoreClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.group-p44",
"DatastoreClusterName": "CA_DS_Cluster"
}
@@ -0,0 +1,34 @@
[
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-40",
"DatastoreName": "MgmtLUN"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-23",
"DatastoreName": "LabPool"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-22",
"DatastoreName": "datastore1 (2)"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-21",
"DatastoreName": "datastore1 (1)"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-19",
"DatastoreName": "datastore1"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-41",
"DatastoreName": "CA_DS_01"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-42",
"DatastoreName": "CA_DS_02"
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-43",
"DatastoreName": "CA_DS_03"
}
]
@@ -0,0 +1,62 @@
[
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-40",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405a18009ded4f84d4177d8893d6",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405a18009ded4f84d4177d8893d6)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 1073741824000,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-22",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.mpx.vmhba1:C0:T0:L0",
"DeviceName": "Local VMware Disk (mpx.vmhba1:C0:T0:L0)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 42949672960,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-42",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405922cd662dc343d4683d9aecd1",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405922cd662dc343d4683d9aecd1)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 536870912000,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-41",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405522c4ad5d65a6d4113d9657dc",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405522c4ad5d65a6d4113d9657dc)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 536870912000,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-43",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.600140533d732abd8caed42cfda50ed1",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.600140533d732abd8caed42cfda50ed1)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 536870912000,
"VmIdentifier": null
}
]
@@ -0,0 +1,62 @@
[
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-40",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405a18009ded4f84d4177d8893d6",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405a18009ded4f84d4177d8893d6)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 1073741824000,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-22",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.mpx.vmhba1:C0:T0:L0",
"DeviceName": "Local VMware Disk (mpx.vmhba1:C0:T0:L0)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 42949672960,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-42",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405922cd662dc343d4683d9aecd1",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405922cd662dc343d4683d9aecd1)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 536870912000,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-41",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.6001405522c4ad5d65a6d4113d9657dc",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.6001405522c4ad5d65a6d4113d9657dc)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 536870912000,
"VmIdentifier": null
},
{
"DatastoreIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.datastore-43",
"DeviceIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.naa.600140533d732abd8caed42cfda50ed1",
"DeviceName": "SYNOLOGY iSCSI Disk (naa.600140533d732abd8caed42cfda50ed1)",
"HostIdentifiers": [
"09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"09db6c5b-b956-430f-9589-b58876ca377a.host-12"
],
"SizeInBytes": 536870912000,
"VmIdentifier": null
}
]
@@ -0,0 +1,4 @@
{
"ClusterIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.domain-c7",
"VirtualizationClusterName": "CA Cluster"
}
@@ -0,0 +1,4 @@
{
"HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"VirtualizationHostName": "caesx3.nc.lab"
}
+14
View File
@@ -0,0 +1,14 @@
[
{
"HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-18",
"VirtualizationHostName": "caesx3.nc.lab"
},
{
"HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-15",
"VirtualizationHostName": "caesx2.nc.lab"
},
{
"HostIdentifier": "09db6c5b-b956-430f-9589-b58876ca377a.host-12",
"VirtualizationHostName": "caesx1.nc.lab"
}
]
@@ -0,0 +1,7 @@
{
"ConnectionType": "ServerMessageBlock",
"Path": "\\\\192.168.1.150\\zBackups",
"RepositoryIdentifier": "120355ce-fcd0-4820-a971-787d0470793b",
"RepositoryName": "Synology",
"StorageType": "NetworkShare"
}
@@ -0,0 +1,51 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).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 13 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 13
}
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 "$global:function::Parameter Functional Tests" {
Mock -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest {
return (Get-Content -Raw "$global:here\Mocks\PairingToken.json" | ConvertFrom-Json)
}
It "Returns a Token" {
$Token = New-ZertoPairingToken
$Token | Should -Not -Be $Null
$Token.Token | Should -Be "TH15ISN0T4R3AL70KEN"
}
It "Returns a ExpirationDate" {
$Token = New-ZertoPairingToken
$Token | Should -Not -Be $Null
$Token.UtcExpirationDate | Should -Be "10/09/2019 12:55 PM"
}
It "Does not return a taskId if '-whatif' is used" {
$results = New-ZertoPairingToken -WhatIf
$results | Should -BeNullOrEmpty
}
Assert-MockCalled -ModuleName ZertoApiWrapper -CommandName Invoke-ZertoRestRequest -Exactly 2
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
@@ -0,0 +1,42 @@
#Requires -Modules Pester
$global:here = (Split-Path -Parent $MyInvocation.MyCommand.Path)
$global:function = ((Split-Path -leaf $MyInvocation.MyCommand.Path).Split('.'))[0]
Describe $global:function -Tag 'Unit', 'Source', 'Built' {
InModuleScope -ModuleName ZertoApiWrapper {
Context "$global:function::Parameter Unit Tests" {
BeforeAll {
$script:ScriptBlock = (Get-Command $global:function).ScriptBlock
}
It "$global:function should have exactly 14 parameters defined" {
(Get-Command $global:function).Parameters.Count | Should -Be 14
}
$ParameterTestCases = @(
@{ParameterName = 'UserCredential'; Type = 'pscredential'; Mandatory = $true }
)
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 "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 "$global:function::Parameter Functional Tests" {
}
}
}
Remove-Variable -Name here -Scope Global
Remove-Variable -Name function -Scope Global
+1 -1
View File
@@ -19,7 +19,7 @@
SkipPublisherCheck = $true SkipPublisherCheck = $true
} }
Target = 'CurrentUser' Target = 'CurrentUser'
Version = '4.8.1' Version = '4.10.1'
Tags = 'Bootstrap' Tags = 'Bootstrap'
} }
+13 -4
View File
@@ -6,21 +6,30 @@ function Add-ZertoPeerSite {
Mandatory = $true, Mandatory = $true,
HelpMessage = "Target Hostname or IP address to pair the localsite to." HelpMessage = "Target Hostname or IP address to pair the localsite to."
)] )]
[ValidateScript( {$_ -match [IPAddress]$_ } )] [ValidateScript( { $_ -match [IPAddress]$_ } )]
[string]$targetHost, [string]$targetHost,
[Parameter( [Parameter(
HelpMessage = "Target communication port. Default is 9081" HelpMessage = "Target communication port. Default is 9081"
)] )]
[ValidateRange(1024, 65535)] [ValidateRange(1024, 65535)]
[int]$targetPort = 9081 [int]$targetPort = 9081,
[Parameter(
HelpMessage = "The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 7.5 and later."
)]
[ValidateNotNullOrEmpty()]
[string]$token
) )
begin { begin {
$baseUri = "peersites"
$body = @{"HostName" = $targetHost; "Port" = $targetPort}
} }
process { process {
$baseUri = "peersites"
if ($PSBoundParameters.Keys.Contains("token")) {
$body = @{ "HostName" = $targetHost; "Port" = $targetPort; "Token" = $token }
} else {
$body = @{ "HostName" = $targetHost; "Port" = $targetPort }
}
if ($PSCmdlet.ShouldProcess("Pairing with Site $targetHost")) { if ($PSCmdlet.ShouldProcess("Pairing with Site $targetHost")) {
Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "POST" Invoke-ZertoRestRequest -uri $baseUri -body $($body | ConvertTo-Json) -method "POST"
} }
+13 -9
View File
@@ -4,10 +4,12 @@ function Checkpoint-ZertoVpg {
param( param(
[Parameter( [Parameter(
Mandatory = $true, Mandatory = $true,
HelpMessage = "Name of the VPG to tag." HelpMessage = "Name of the VPG to tag.",
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$vpgName, [string[]]$vpgName,
[Parameter( [Parameter(
Mandatory = $true, Mandatory = $true,
HelpMessage = "Text to tag the checkpoint with." HelpMessage = "Text to tag the checkpoint with."
@@ -18,16 +20,18 @@ function Checkpoint-ZertoVpg {
begin { begin {
$baseUri = "vpgs" $baseUri = "vpgs"
$vpgIdentifier = $(get-zertovpg -name $vpgName).vpgIdentifier
$body = @{"checkpointName" = $checkpointName}
} }
process { process {
if ($vpgIdentifier) { foreach ($name in $vpgName) {
$uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier $vpgIdentifier = $(get-zertovpg -name $name).vpgIdentifier
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST" if ($vpgIdentifier) {
} else { $uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier
Write-Output "Cannot find VPG named $vpgName. Please check the name and try again." $body = @{"checkpointName" = $checkpointName}
Invoke-ZertoRestRequest -uri $uri -body $($body | ConvertTo-Json) -method "POST"
} else {
Write-Output "Cannot find VPG named $name. Please check the name and try again."
}
} }
} }
+67
View File
@@ -0,0 +1,67 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Copy-ZertoVpg {
[CmdletBinding(SupportsShouldProcess)]
param (
# VPG Name to Clone
[Parameter(Mandatory,
HelpMessage = "Name of the VPG to clone")]
[ValidateNotNullOrEmpty()]
[String]$SourceVpgName,
# New VPG Name
[Parameter(Mandatory,
HelpMessage = "Name to assign the newly created VPG")]
[ValidateNotNullOrEmpty()]
[String]$NewVpgName, # Name of VMs to add to the VPG
[Parameter(Mandatory,
HelpMessage = "Name(s) of the Virtual Machine(s) to add to the VPG")]
[ValidateNotNullOrEmpty()]
[String[]]$VMs
)
begin {
}
process {
$VpgIdToCopy = @{ VpgIdentifier = (Get-ZertoVpg -vpgName $SourceVpgName).vpgIdentifier }
if ( $null -eq $VpgIdToCopy.VpgIdentifier ) {
Write-Error -Message "Unable to find a VPG with the name: $SourceVpgName. Please check the name and try again."
Break
} elseif ($VpgIdToCopy.VpgIdentifier.Count -gt 1) {
Write-Error -Message "More than one VPG was returned when searching for the VPG name: $SourceVpgName. Please try again."
Break
}
$BaseUri = "vpgSettings/copyVpgSettings"
$UnprotectedVms = Get-ZertoUnprotectedVm
$ProtectedVms = Get-ZertoProtectedVm
$VMsToAdd = foreach ($VM in $VMs) {
if ($UnprotectedVms.VmName -contains $VM) {
$VmId = $UnprotectedVms | Where-Object { $_.VmName -like $VM } | Select-Object -ExpandProperty VmIdentifier
} elseif ($ProtectedVms.VmName -contains $VM) {
$VmId = $ProtectedVms | Where-Object { $_.VmName -like $VM } | Select-Object -ExpandProperty VmIdentifier
} else {
Write-Warning -Message "Unable to find VM with Name $VM. Skipping."
}
$returnObject = New-Object PSObject
$returnObject | Add-Member -MemberType NoteProperty -Name "VmIdentifier" -Value $VmId
$returnObject
}
if ($PSCmdlet.ShouldProcess("$VMsToAdd", "Copying $SourceVpgName to $NewVpgName with Settings")) {
$NewVpgId = Invoke-ZertoRestRequest -Uri $BaseUri -Body ($VpgIdToCopy | ConvertTo-Json) -Method "POST"
$Uri = "{0}/{1}/vms" -f "vpgSettings", $NewVpgId
foreach ($VM in $VMsToAdd) {
$null = Invoke-ZertoRestRequest -Uri $Uri -Body ($VM | ConvertTo-Json) -Method "POST"
}
$Uri = "vpgSettings/{0}" -f $NewVpgId
$CurrentSettings = Invoke-ZertoRestRequest -Uri $Uri
$CurrentSettings.Basic.Name = $NewVpgName
$Null = Invoke-ZertoRestRequest -Uri $Uri -Method "Put" -Body $($CurrentSettings | ConvertTo-Json -Depth 20)
Save-ZertoVpgSetting -vpgSettingsIdentifier $NewVpgId
}
}
end {
}
}
+19 -7
View File
@@ -18,20 +18,26 @@ function Edit-ZertoVra {
ParameterSetName = "StaticIp", ParameterSetName = "StaticIp",
HelpMessage = "Static IP address to assign to the VRA." HelpMessage = "Static IP address to assign to the VRA."
)] )]
[ValidateScript( {$_ -match [IPAddress]$_ })] [ValidateScript( { $_ -match [IPAddress]$_ })]
[string]$vraIpAddress, [string]$vraIpAddress,
[Parameter( [Parameter(
ParameterSetName = "StaticIp", ParameterSetName = "StaticIp",
HelpMessage = "Default gateway to assign to the VRA" HelpMessage = "Default gateway to assign to the VRA"
)] )]
[ValidateScript( {$_ -match [IPAddress]$_ })] [ValidateScript( { $_ -match [IPAddress]$_ })]
[string]$defaultGateway, [string]$defaultGateway,
[Parameter( [Parameter(
ParameterSetName = "StaticIp", ParameterSetName = "StaticIp",
HelpMessage = "Subnetmask to be assigned to the VRA" HelpMessage = "Subnetmask to be assigned to the VRA"
)] )]
[ValidateScript( {$_ -match [IPAddress]$_ })] [ValidateScript( { $_ -match [IPAddress]$_ })]
[string]$subnetMask [string]$subnetMask,
[Parameter(
HelpMessage = "Updated ESXi host root password."
)]
[ValidateNotNullOrEmpty()]
[securestring]$HostRootPassword
) )
begin { begin {
@@ -45,8 +51,8 @@ function Edit-ZertoVra {
process { process {
# Create ordered hashtables to be converted later to JSON. # Create ordered hashtables to be converted later to JSON.
$vraUpdate = [ordered]@{} $vraUpdate = [ordered]@{ }
$vraNetwork = [ordered]@{} $vraNetwork = [ordered]@{ }
# If a new group name is specified, update. # If a new group name is specified, update.
if ( $PSBoundParameters.ContainsKey('GroupName')) { if ( $PSBoundParameters.ContainsKey('GroupName')) {
$vraUpdate['GroupName'] = $groupName $vraUpdate['GroupName'] = $groupName
@@ -77,8 +83,14 @@ function Edit-ZertoVra {
$vraNetwork['VraIPConfigurationTypeApi'] = "Dhcp" $vraNetwork['VraIPConfigurationTypeApi'] = "Dhcp"
$vraUpdate['VraNetworkDataApi'] = $vraNetwork $vraUpdate['VraNetworkDataApi'] = $vraNetwork
} }
if ($PSBoundParameters.ContainsKey('HostRootPassword')) {
$HostRootCredential = [pscredential]::New('root', $HostRootPassword)
$vraUpdate['UsePublicKeyInsteadOfCredentials'] = $false
$vraUpdate['HostRootPassword'] = $HostRootCredential.GetNetworkCredential().Password
}
# -WhatIf processing and submit! # -WhatIf processing and submit!
if ($PSCmdlet.ShouldProcess( "Updating " + $vra.vraName + " with these settings: $($vraUpdate | convertTo-Json)")) { if ($PSCmdlet.ShouldProcess( $vra.vraName )) {
Invoke-ZertoRestRequest -uri $baseUri -body $($vraUpdate | ConvertTo-Json) -method "PUT" Invoke-ZertoRestRequest -uri $baseUri -body $($vraUpdate | ConvertTo-Json) -method "PUT"
} }
} }
@@ -45,33 +45,37 @@ function Export-ZertoVmNicSetting {
$null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $settingsId $null = Remove-ZertoVpgSettingsIdentifier -vpgSettingsIdentifier $settingsId
$networkMap = Get-Map -InputObject $networks -key "NetworkIdentifier" -value "VirtualizationNetworkName" $networkMap = Get-Map -InputObject $networks -key "NetworkIdentifier" -value "VirtualizationNetworkName"
foreach ($vm in $vmSettings) { foreach ($vm in $vmSettings) {
$nicInfo = [PSCustomObject]@{ if ($vm.nics.count -gt 0) {
VPGName = $group.VPGName foreach ($nic in $vm.nics) {
VMName = $vmMap[$($vm.vmIdentifier)] $nicInfo = [PSCustomObject]@{
NicIdentifier = $vm.nics.NicIdentifier VPGName = $group.VPGName
LiveNetwork = $networkMap[$vm.nics.failover.Hypervisor.NetworkIdentifier] VMName = $vmMap[$vm.vmIdentifier]
LiveShouldReplaceMac = $vm.nics.failover.Hypervisor.ShouldReplaceMacAddress NicIdentifier = $nic.NicIdentifier
LiveIsDHCP = $vm.Nics.failover.Hypervisor.IpConfig.IsDhcp LiveNetwork = $networkMap[$nic.failover.Hypervisor.NetworkIdentifier]
LiveIpAddress = $vm.nics.failover.Hypervisor.IpConfig.StaticIp LiveShouldReplaceMac = $nic.failover.Hypervisor.ShouldReplaceMacAddress
LiveIpSubnetMask = $vm.nics.failover.Hypervisor.IpConfig.SubnetMask LiveIsDHCP = $nic.failover.Hypervisor.IpConfig.IsDhcp
LiveIpDefaultGateway = $vm.nics.failover.Hypervisor.IpConfig.Gateway LiveIpAddress = $nic.failover.Hypervisor.IpConfig.StaticIp
LivePrimaryDns = $vm.nics.failover.Hypervisor.IpConfig.PrimaryDns LiveIpSubnetMask = $nic.failover.Hypervisor.IpConfig.SubnetMask
LiveSecondayDns = $vm.nics.failover.Hypervisor.IpConfig.SecondaryDns LiveIpDefaultGateway = $nic.failover.Hypervisor.IpConfig.Gateway
LiveDnsSuffix = $vm.nics.failover.Hypervisor.DnsSuffix LivePrimaryDns = $nic.failover.Hypervisor.IpConfig.PrimaryDns
TestNetwork = $networkMap[$vm.nics.failoverTest.Hypervisor.NetworkIdentifier] LiveSecondayDns = $nic.failover.Hypervisor.IpConfig.SecondaryDns
TestShouldReplaceMac = $vm.nics.failoverTest.Hypervisor.ShouldReplaceMacAddress LiveDnsSuffix = $nic.failover.Hypervisor.DnsSuffix
TestIsDHCP = $vm.Nics.failoverTest.Hypervisor.IpConfig.IsDhcp TestNetwork = $networkMap[$nic.failoverTest.Hypervisor.NetworkIdentifier]
TestIpAddress = $vm.nics.failoverTest.Hypervisor.IpConfig.StaticIp TestShouldReplaceMac = $nic.failoverTest.Hypervisor.ShouldReplaceMacAddress
TestIpSubnetMask = $vm.nics.failoverTest.Hypervisor.IpConfig.SubnetMask TestIsDHCP = $nic.failoverTest.Hypervisor.IpConfig.IsDhcp
TestIpDefaultGateway = $vm.nics.failoverTest.Hypervisor.IpConfig.Gateway TestIpAddress = $nic.failoverTest.Hypervisor.IpConfig.StaticIp
TestPrimaryDns = $vm.nics.failoverTest.Hypervisor.IpConfig.PrimaryDns TestIpSubnetMask = $nic.failoverTest.Hypervisor.IpConfig.SubnetMask
TestSecondayDns = $vm.nics.failoverTest.Hypervisor.IpConfig.SecondaryDns TestIpDefaultGateway = $nic.failoverTest.Hypervisor.IpConfig.Gateway
TestDnsSuffix = $vm.nics.failoverTest.Hypervisor.DnsSuffix TestPrimaryDns = $nic.failoverTest.Hypervisor.IpConfig.PrimaryDns
TestSecondayDns = $nic.failoverTest.Hypervisor.IpConfig.SecondaryDns
TestDnsSuffix = $nic.failoverTest.Hypervisor.DnsSuffix
}
$nicInfo
}
} }
$nicInfo
} }
} }
$nicSettings | Export-Csv -Path $OutputFile $nicSettings | Export-Csv -Path $OutputFile -NoTypeInformation
} }
end { end {
@@ -0,0 +1,58 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAPlannerJournalSizeReport {
[cmdletbinding()]
param(
[Parameter(
Mandatory,
HelpMessage = "The site identifier(s) for which to return detailed information."
)]
[ValidateNotNullOrEmpty()]
[string]$siteIdentifier,
[Parameter(
Mandatory,
HelpMessage = "Type of target recovery site."
)]
[ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')]
[string]$recoveryType,
[Parameter(
Mandatory,
HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site."
)]
[ValidateNotNullOrEmpty()]
[string[]]$vmIdentifier,
[Parameter(
HelpMessage = "The desired journal history in hours. The default is 24 hours. Limited to a 1 hour up to 720 hours, or the equivalent of 30 days"
)]
[ValidateRange(1, 720)]
[Int]$desiredJournalHistory = 24,
[Parameter(
HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago."
)]
[ValidateNotNullOrEmpty()]
[string]$startDate,
[Parameter(
HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time."
)]
[ValidateNotNullOrEmpty()]
[string]$endDate
)
$uri = "planner/reports/stats/journal-size"
$body = @{
siteIdentifier = $siteIdentifier
recoveryType = $recoveryType
desiredJournalHistory = $desiredJournalHistory
vms = New-Object System.Collections.Generic.List[psobject]
}
if ( -not [String]::IsNullOrEmpty($startDate) ) {
$body['startDate'] = $startDate
}
if ( -not [String]::IsNullOrEmpty($endDate) ) {
$body['endDate'] = $endDate
}
foreach ($vmId in $vmIdentifier) {
$body['vms'].Add(@{'identifier' = $vmId; 'desiredJournalHistory' = $desiredJournalHistory })
}
$reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json)
$uri = '{0}?reportId={1}' -f $uri, $reportId.reportId
Invoke-ZARestRequest -uri $uri
}
@@ -0,0 +1,58 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAPlannerNetworkPerformanceReport {
[cmdletbinding()]
param(
[Parameter(
Mandatory,
HelpMessage = "The site identifier(s) for which to return detailed information."
)]
[ValidateNotNullOrEmpty()]
[string]$siteIdentifier,
[Parameter(
Mandatory,
HelpMessage = "Type of target recovery site."
)]
[ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')]
[string]$recoveryType,
[Parameter(
Mandatory,
HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site."
)]
[ValidateNotNullOrEmpty()]
[string[]]$vmIdentifier,
[Parameter(
HelpMessage = "The desired sample interval in seconds. The default is 3600 seconds (1 Hour). Limited to a 60 second to 86,400 second (24 Hour) interval"
)]
[ValidateRange(60, 86400)]
[Int]$interval = 3600,
[Parameter(
HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago."
)]
[ValidateNotNullOrEmpty()]
[string]$startDate,
[Parameter(
HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time."
)]
[ValidateNotNullOrEmpty()]
[string]$endDate
)
$uri = "planner/reports/network-performance"
$body = @{
siteIdentifier = $siteIdentifier
recoveryType = $recoveryType
interval = $interval
vmIdentifiers = New-Object System.Collections.Generic.List[psobject]
}
if ( -not [String]::IsNullOrEmpty($startDate) ) {
$body['startDate'] = $startDate
}
if ( -not [String]::IsNullOrEmpty($endDate) ) {
$body['endDate'] = $endDate
}
foreach ($vmId in $vmIdentifier) {
$body['vmIdentifiers'].Add($vmId)
}
$reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json)
$uri = '{0}?reportId={1}' -f $uri, $reportId.reportId
Invoke-ZARestRequest -uri $uri
}
@@ -0,0 +1,22 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAPlannerSite {
[cmdletbinding()]
param(
[Parameter(
HelpMessage = "The site identifier(s) for which to return detailed information."
)]
[ValidateNotNullOrEmpty()]
[string[]]$siteIdentifier
)
$uri = "planner/sites"
if ( -not [String]::IsNullorEmpty($siteIdentifier) ) {
$entry = foreach ($id in $siteIdentifier) {
"{0}/{1}" -f $uri, $id
}
} else {
$entry = $uri
}
foreach ($uri in $entry) {
Invoke-ZARestRequest -uri $uri
}
}
@@ -0,0 +1,58 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAPlannerStatsReport {
[cmdletbinding()]
param(
[Parameter(
Mandatory,
HelpMessage = "The site identifier(s) for which to return detailed information."
)]
[ValidateNotNullOrEmpty()]
[string]$siteIdentifier,
[Parameter(
Mandatory,
HelpMessage = "Type of target recovery site."
)]
[ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')]
[string]$recoveryType,
[Parameter(
Mandatory,
HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site."
)]
[ValidateNotNullOrEmpty()]
[string[]]$vmIdentifier,
[Parameter(
HelpMessage = "The desired journal history in hours. The default is 24 hours. Limited to a 1 hour up to 720 hours, or the equivalent of 30 days"
)]
[ValidateRange(1, 720)]
[Int]$desiredJournalHistory = 24,
[Parameter(
HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago."
)]
[ValidateNotNullOrEmpty()]
[string]$startDate,
[Parameter(
HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time."
)]
[ValidateNotNullOrEmpty()]
[string]$endDate
)
$uri = "planner/reports/stats"
$body = @{
siteIdentifier = $siteIdentifier
recoveryType = $recoveryType
desiredJournalHistory = $desiredJournalHistory
vms = New-Object System.Collections.Generic.List[psobject]
}
if ( -not [String]::IsNullOrEmpty($startDate) ) {
$body['startDate'] = $startDate
}
if ( -not [String]::IsNullOrEmpty($endDate) ) {
$body['endDate'] = $endDate
}
foreach ($vmId in $vmIdentifier) {
$body['vms'].Add(@{'identifier' = $vmId; 'desiredJournalHistory' = $desiredJournalHistory })
}
$reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json)
$uri = '{0}?reportId={1}' -f $uri, $reportId.reportId
Invoke-ZARestRequest -uri $uri
}
@@ -0,0 +1,52 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAPlannerWanReport {
[cmdletbinding()]
param(
[Parameter(
Mandatory,
HelpMessage = "The site identifier(s) for which to return detailed information."
)]
[ValidateNotNullOrEmpty()]
[string]$siteIdentifier,
[Parameter(
Mandatory,
HelpMessage = "Type of target recovery site."
)]
[ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')]
[string]$recoveryType,
[Parameter(
Mandatory,
HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site."
)]
[ValidateNotNullOrEmpty()]
[string[]]$vmIdentifier,
[Parameter(
HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago."
)]
[ValidateNotNullOrEmpty()]
[string]$startDate,
[Parameter(
HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time."
)]
[ValidateNotNullOrEmpty()]
[string]$endDate
)
$uri = "planner/reports/stats/wan"
$body = @{
siteIdentifier = $siteIdentifier
recoveryType = $recoveryType
vmIdentifiers = New-Object System.Collections.Generic.List[psobject]
}
if ( -not [String]::IsNullOrEmpty($startDate) ) {
$body['startDate'] = $startDate
}
if ( -not [String]::IsNullOrEmpty($endDate) ) {
$body['endDate'] = $endDate
}
foreach ($vmId in $vmIdentifier) {
$body['vmIdentifiers'].Add($vmId)
}
$reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json)
$uri = '{0}?reportId={1}' -f $uri, $reportId.reportId
Invoke-ZARestRequest -uri $uri
}
@@ -0,0 +1,54 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAPlannerZcasReport {
[cmdletbinding()]
param(
[Parameter(
Mandatory,
HelpMessage = "The site identifier(s) for which to return detailed information."
)]
[ValidateNotNullOrEmpty()]
[string]$siteIdentifier,
[Parameter(
Mandatory,
HelpMessage = "Type of target recovery site."
)]
[ValidateSet('azure', 'vcenter', 'vcd', 'scvmm', 'aws')]
[string]$recoveryType,
[Parameter(
Mandatory,
HelpMessage = "Identifiers of the VMs you want to recover at the target recovery site."
)]
[ValidateNotNullOrEmpty()]
[string[]]$vmIdentifier,
[Parameter(
HelpMessage = "The earliest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is one year ago."
)]
[ValidateNotNullOrEmpty()]
[string]$startDate,
[Parameter(
HelpMessage = "The latest timestamp of an event to return, in RFC 3339 standard. ('1970-01-01T00:00:00Z'). The default is the current time."
)]
[ValidateNotNullOrEmpty()]
[string]$endDate
)
$uri = "planner/reports/stats/zcas"
$body = @{
siteIdentifier = $siteIdentifier
recoveryType = $recoveryType
vmIdentifiers = New-Object System.Collections.Generic.List[psobject]
}
if ( -not [String]::IsNullOrEmpty($startDate) ) {
$body['startDate'] = $startDate
}
if ( -not [String]::IsNullOrEmpty($endDate) ) {
$body['endDate'] = $endDate
}
foreach ($vmId in $vmIdentifier) {
$body['vmIdentifiers'].Add($vmId)
}
#$body | ConvertTo-Json
$reportId = Invoke-ZARestRequest -uri $uri -method POST -body ($body | ConvertTo-Json)
#Start-Sleep 10
$uri = '{0}?reportId={1}' -f $uri, $reportId.reportId
Invoke-ZARestRequest -uri $uri
}
@@ -0,0 +1,51 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAProtectedVm {
[cmdletbinding(DefaultParameterSetName = "AllVMs")]
param(
[Parameter(
ParameterSetName = "AllVMs",
HelpMessage = "Use this switch when you want a list of all protected VMs. Please be warned this list can be quite large."
)]
[switch]$AllVms,
[Parameter(
ParameterSetName = "IndividualVMs",
Mandatory,
HelpMessage = "A list of VM identifiers to query"
)]
[ValidateNotNullOrEmpty()]
[string[]]$VMIdentifier,
[Parameter(
ParameterSetName = "IndividualVMs",
HelpMessage = "Specify this switch when you would like protected vms' volume information returned"
)]
[switch]$Volumes
)
Begin {
}
Process {
$BaseUri = "monitoring/protected-vms"
switch ($PSCmdlet.ParameterSetName) {
"AllVMs" {
Invoke-ZARestRequest -uri $BaseUri
}
"IndividualVMs" {
foreach ($identifier in $VMIdentifier) {
if ($Volumes.IsPresent) {
$Uri = "{0}/{1}/volumes" -f $BaseUri, $identifier
} else {
$uri = $Uri = "{0}/{1}" -f $BaseUri, $identifier
}
Invoke-ZARestRequest -uri $Uri
}
}
}
}
End {
}
}
@@ -0,0 +1,32 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Get-ZAProtectedVmReport {
[cmdletbinding()]
param(
[Parameter(
ParameterSetName = "GenerateReport",
Mandatory,
HelpMessage = "A list of VM identifiers to include in the report."
)]
[ValidateNotNullOrEmpty()]
[string[]]$VMIdentifier
)
Begin {
}
Process {
$BaseUri = "monitoring/protected-vms"
$Body = @{
vmsIdentifiers = $VMIdentifier
}
$reportId = Invoke-ZARestRequest -uri $BaseUri -method POST -body ($Body | ConvertTo-Json)
Start-Sleep 1
$Uri = "{0}?reportId={1}" -f $BaseUri, $reportId.reportId
Invoke-ZARestRequest -uri $Uri
}
End {
}
}
@@ -26,12 +26,6 @@ function Get-ZertoRecoveryReport {
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$pageSize, [string]$pageSize,
[Parameter(
ParameterSetName = "filter",
HelpMessage = "The internal identifier of the VPG. You can specify more than one VPG, separated by commas."
)]
[ValidateNotNullOrEmpty()]
[string]$vpgIdentifier,
[Parameter( [Parameter(
ParameterSetName = "filter", ParameterSetName = "filter",
HelpMessage = "The name of the VPG. You can specify more than one VPG, separated by commas." HelpMessage = "The name of the VPG. You can specify more than one VPG, separated by commas."
@@ -52,6 +52,11 @@ function Get-ZertoVirtualizationSite {
Mandatory = $true, Mandatory = $true,
HelpMessage = "The identifier of the Zerto Virtual Manager site." HelpMessage = "The identifier of the Zerto Virtual Manager site."
)] )]
[Parameter(
ParameterSetName = "repositories",
Mandatory = $true,
HelpMessage = "The identifier of the Zerto Virtual Manager site."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("siteId")] [Alias("siteId")]
[string]$siteIdentifier, [string]$siteIdentifier,
@@ -121,33 +126,34 @@ function Get-ZertoVirtualizationSite {
Mandatory = $true, Mandatory = $true,
HelpMessage = "Return all VMs at the selected site." HelpMessage = "Return all VMs at the selected site."
)] )]
[switch]$vms [switch]$vms,
[Parameter(
ParameterSetName = "repositories",
Mandatory = $true,
HelpMessage = "The identifier of the Zerto Virtual Manager site."
)]
[switch]$repositories
) )
begin { begin {
$baseUri = "virtualizationsites"
$returnObject = @()
} }
process { process {
# Return information based on ParameterSetName invoked. # Return information based on ParameterSetName invoked.
$baseUri = "virtualizationsites"
switch ( $PSCmdlet.ParameterSetName ) { switch ( $PSCmdlet.ParameterSetName ) {
# If no ParameterSetName is specified, return all data # If no ParameterSetName is specified, return all data
"main" { "main" {
$returnObject = Invoke-ZertoRestRequest -uri $baseUri $uri = $baseUri
} }
# If devices is specified along with a hostId, build return just that host information, otherwise return all devices at the site # If devices is specified along with a hostId, build return just that host information, otherwise return all devices at the site
#TODO - remove foreach, only one siteIdentifier can be specified.
"devices" { "devices" {
$returnObject = foreach ( $id in $siteIdentifier ) { if ( $PSBoundParameters.ContainsKey( "hostIdentifier" ) ) {
if ( $PSBoundParameters.ContainsKey( "hostIdentifier" ) ) { $uri = "{0}/{1}/devices?hostIdentifier={2}" -f $baseUri, $siteIdentifier, $hostIdentifier
$uri = "{0}/{1}/devices?hostIdentifier={2}" -f $baseUri, $siteIdentifier, $hostIdentifier } else {
} else { $uri = "{0}/{1}/devices" -f $baseUri, $siteIdentifier
$uri = "{0}/{1}/devices" -f $baseUri, $siteIdentifier
}
Invoke-ZertoRestRequest -uri $uri
} }
} }
@@ -158,24 +164,22 @@ function Get-ZertoVirtualizationSite {
} else { } else {
$uri = "{0}/{1}/hosts" -f $baseUri, $siteIdentifier $uri = "{0}/{1}/hosts" -f $baseUri, $siteIdentifier
} }
$returnObject = Invoke-ZertoRestRequest -uri $uri
} }
# If siteIdentifier is specified, return information for that site. # If siteIdentifier is specified, return information for that site.
"siteIdentifier" { "siteIdentifier" {
$uri = "{0}/{1}" -f $baseUri, $siteIdentifier $uri = "{0}/{1}" -f $baseUri, $siteIdentifier
$returnObject = Invoke-ZertoRestRequest -uri $uri
} }
# If a different ParameterSetName is selected, use that information to build the URI and return that information # If a different ParameterSetName is selected, use that information to build the URI and return that information
default { default {
$uri = "{0}/{1}/{2}" -f $baseUri, $siteIdentifier, $PSCmdlet.ParameterSetName.ToLower() $uri = "{0}/{1}/{2}" -f $baseUri, $siteIdentifier, $PSCmdlet.ParameterSetName.ToLower()
$returnObject = Invoke-ZertoRestRequest -uri $uri
} }
} }
Invoke-ZertoRestRequest -uri $uri
} }
end { end {
return $returnObject
} }
} }
+12 -16
View File
@@ -160,7 +160,6 @@ function Get-ZertoVpg {
) )
begin { begin {
$baseUri = "vpgs" $baseUri = "vpgs"
$returnObject = @()
} }
Process { Process {
@@ -169,14 +168,13 @@ function Get-ZertoVpg {
# When called with no parameters, return all values # When called with no parameters, return all values
"main" { "main" {
$returnObject = Invoke-ZertoRestRequest -uri $baseUri $uri = $baseUri
} }
# When called with protectionGroupIdentifier, query for each id provided # When called with protectionGroupIdentifier, query for each id provided
"protectionGroupIdentifier" { "protectionGroupIdentifier" {
$returnObject = foreach ( $vpgId in $protectionGroupIdentifier ) { $uri = foreach ( $vpgId in $protectionGroupIdentifier ) {
$uri = "{0}/{1}" -f $baseUri, $vpgId "{0}/{1}" -f $baseUri, $vpgId
Invoke-ZertoRestRequest -uri $uri
} }
} }
@@ -185,7 +183,7 @@ function Get-ZertoVpg {
$filter = $false $filter = $false
if ( $PSBoundParameters.ContainsKey("startDate") -or $PSBoundParameters.ContainsKey("endDate") ) { if ( $PSBoundParameters.ContainsKey("startDate") -or $PSBoundParameters.ContainsKey("endDate") ) {
$filter = $true $filter = $true
$filterTable = @{} $filterTable = @{ }
foreach ( $param in $PSBoundParameters.GetEnumerator() ) { foreach ( $param in $PSBoundParameters.GetEnumerator() ) {
if ( $param.key -eq "startDate" -or $param.key -eq "endDate") { if ( $param.key -eq "startDate" -or $param.key -eq "endDate") {
$filterTable[$param.key] = $param.value $filterTable[$param.key] = $param.value
@@ -193,21 +191,19 @@ function Get-ZertoVpg {
} }
$filter = Get-ZertoApiFilter -filterTable $filterTable $filter = Get-ZertoApiFilter -filterTable $filterTable
} }
$returnObject = foreach ( $id in $protectionGroupIdentifier ) { $uri = foreach ( $id in $protectionGroupIdentifier ) {
if ( $filter ) { if ( $filter ) {
$uri = "{0}/{1}/checkpoints{2}" -f $baseUri, $id, $filter "{0}/{1}/checkpoints{2}" -f $baseUri, $id, $filter
} else { } else {
$uri = "{0}/{1}/checkpoints" -f $baseUri, $id "{0}/{1}/checkpoints" -f $baseUri, $id
} }
Invoke-ZertoRestRequest -uri $uri
} }
} }
# When stats are requested # When stats are requested
"stats" { "stats" {
$returnObject = foreach ( $id in $protectionGroupIdentifier ) { $uri = foreach ( $id in $protectionGroupIdentifier ) {
$uri = "{0}/{1}/checkpoints/stats" -f $baseUri, $id "{0}/{1}/checkpoints/stats" -f $baseUri, $id
Invoke-ZertoRestRequest -uri $uri
} }
} }
@@ -215,18 +211,18 @@ function Get-ZertoVpg {
"filter" { "filter" {
$filter = Get-ZertoApiFilter -filterTable $PSBoundParameters $filter = Get-ZertoApiFilter -filterTable $PSBoundParameters
$uri = "{0}{1}" -f $baseUri, $filter $uri = "{0}{1}" -f $baseUri, $filter
$returnObject = Invoke-ZertoRestRequest -uri $uri
} }
# Default is to build URI based on ParameterSetName and return results. # Default is to build URI based on ParameterSetName and return results.
default { default {
$uri = "{0}/{1}" -f $baseUri, $PSCmdlet.ParameterSetName.ToLower() $uri = "{0}/{1}" -f $baseUri, $PSCmdlet.ParameterSetName.ToLower()
$returnObject = Invoke-ZertoRestRequest -uri $uri
} }
} }
foreach ($entry in $uri) {
Invoke-ZertoRestRequest -uri $entry
}
} }
End { End {
return $returnObject
} }
} }
+23 -7
View File
@@ -19,7 +19,7 @@ function Get-ZertoVpgSetting {
ValueFromPipelineByPropertyName = $true, ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true, ValueFromRemainingArguments = $true,
Mandatory = $true, Mandatory = $true,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[Parameter( [Parameter(
ParameterSetName = "dayOfWeek", ParameterSetName = "dayOfWeek",
@@ -149,31 +149,39 @@ function Get-ZertoVpgSetting {
Mandatory = $true, Mandatory = $true,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved." HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)] )]
[Parameter(
ParameterSetName = "ltr",
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
ValueFromRemainingArguments = $true,
Mandatory = $true,
HelpMessage = "The identifier of the VPG settings object for which information is retrieved."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("vpgSettingsId", "settingsId")] [Alias("vpgSettingsId", "settingsId")]
[string[]]$vpgSettingsIdentifier, [string[]]$vpgSettingsIdentifier,
[Parameter( [Parameter(
ParameterSetName = "backup", ParameterSetName = "backup",
Mandatory = $true, Mandatory = $true,
HelpMessage = "Return backup information for VPG identifier specified" HelpMessage = "Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$backup, [switch]$backup,
[Parameter( [Parameter(
ParameterSetName = "dayOfWeek", ParameterSetName = "dayOfWeek",
Mandatory = $true, Mandatory = $true,
HelpMessage = "Get the day of week a backup is scheduled" HelpMessage = "Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$dayOfWeek, [switch]$dayOfWeek,
[Parameter( [Parameter(
ParameterSetName = "retentionPeriod", ParameterSetName = "retentionPeriod",
Mandatory = $true, Mandatory = $true,
HelpMessage = "Get the retention period for a backup" HelpMessage = "Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$retentionPeriod, [switch]$retentionPeriod,
[Parameter( [Parameter(
ParameterSetName = "schedulerPeriod", ParameterSetName = "schedulerPeriod",
Mandatory = $true, Mandatory = $true,
HelpMessage = "Get the backup schedule" HelpMessage = "Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error."
)] )]
[switch]$schedulerPeriod, [switch]$schedulerPeriod,
[Parameter( [Parameter(
@@ -211,7 +219,8 @@ function Get-ZertoVpgSetting {
Mandatory = $true, Mandatory = $true,
HelpMessage = "Get VPG Recovery Settings" HelpMessage = "Get VPG Recovery Settings"
)] )]
[switch]$rcovery, [Alias("rcovery")]
[switch]$recovery,
[Parameter( [Parameter(
ParameterSetName = "scripting", ParameterSetName = "scripting",
Mandatory = $true, Mandatory = $true,
@@ -279,7 +288,14 @@ function Get-ZertoVpgSetting {
)] )]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[Alias("volumeId")] [Alias("volumeId")]
[string]$volumeIdentifier [string]$volumeIdentifier,
[Parameter(
ParameterSetName = "ltr",
Mandatory = $true,
HelpMessage = "Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error."
)]
[switch]$ltr
) )
begin { begin {
@@ -44,15 +44,28 @@ function Import-ZertoVmNicSetting {
[string]::IsNullOrWhiteSpace($Vm.LiveShouldReplaceMac) -or [string]::IsNullOrWhiteSpace($Vm.LiveShouldReplaceMac) -or
[string]::IsNullOrWhiteSpace($Vm.TestNetwork) -or [string]::IsNullOrWhiteSpace($Vm.TestNetwork) -or
[string]::IsNullOrWhiteSpace($Vm.TestShouldReplaceMac)) { [string]::IsNullOrWhiteSpace($Vm.TestShouldReplaceMac)) {
Write-Error "$($Vm.VMName) does not contain all the required data. Please check the CSV entry for this item and try again." -ErrorAction Continue Write-Error "$($Vm.VMName) does not contain all the required data. Please check the CSV entry for this item and try again. You are required to provide the VPGName, VMName, NicIdentifier, LiveNetwork, and ShouldReplaceMacAddress for each Nic." -ErrorAction Continue
} else { } else {
$uri = "vpgSettings/{0}/vms/{1}" -f $vpgSettingsId, $vmMap[$vm.VMName] $uri = "vpgSettings/{0}/vms/{1}" -f $vpgSettingsId, $vmMap[$vm.VMName]
$VmNicSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsId -vmIdentifier $vmMap[$vm.VMName] $VmNicSettings = Get-ZertoVpgSetting -vpgSettingsIdentifier $vpgSettingsId -vmIdentifier $vmMap[$vm.VMName]
foreach ($nic in $VmNicSettings.nics) { foreach ($nic in $VmNicSettings.nics) {
if ($nic.NicIdentifier -eq $vm.NicIdentifier) { if ($nic.NicIdentifier -eq $vm.NicIdentifier) {
$nic.failover.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.LiveNetwork] $NicUri = "{0}/nics/{1}" -f $uri, $nic.NicIdentifier
$nic.failover.Hypervisor.ShouldReplaceMacAddress = $vm.LiveShouldReplaceMac Invoke-ZertoRestRequest -uri $NicUri -Method "DELETE" > $null
if ($null -eq $nic.failover.Hypervisor.IpConfig -and ($null -ne $vm.LiveIsDHCP -or $null -ne $vm.LiveIpAddress)) { $nicSettings = Invoke-ZertoRestRequest -uri $NicUri -Method "GET"
$nicSettings.failover.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.LiveNetwork]
$nicSettings.failover.Hypervisor.ShouldReplaceMacAddress = $vm.LiveShouldReplaceMac
if ($vm.LiveIsDHCP -imatch "true") {
$IpConfig = [PSCustomObject]@{
IsDhcp = $vm.LiveIsDHCP
PrimaryDns = $vm.LivePrimaryDns
SecondaryDns = $vm.LiveSecondayDns
}
$nicSettings.failover.Hypervisor.IpConfig = $IpConfig
$nicSettings.failover.Hypervisor.DnsSuffix = $vm.LiveDnsSuffix
} elseif (($vm.LiveIsDHCP -imatch "false" -or
[string]::IsNullOrWhiteSpace($vm.LiveIsDHCP)) -and
-not [string]::IsNullOrWhiteSpace($vm.LiveIpAddress)) {
$IpConfig = [PSCustomObject]@{ $IpConfig = [PSCustomObject]@{
IsDhcp = $vm.LiveIsDHCP IsDhcp = $vm.LiveIsDHCP
StaticIp = $vm.LiveIpAddress StaticIp = $vm.LiveIpAddress
@@ -61,21 +74,22 @@ function Import-ZertoVmNicSetting {
PrimaryDns = $vm.LivePrimaryDns PrimaryDns = $vm.LivePrimaryDns
SecondaryDns = $vm.LiveSecondayDns SecondaryDns = $vm.LiveSecondayDns
} }
$nic.failover.Hypervisor.IpConfig = $IpConfig $nicSettings.failover.Hypervisor.IpConfig = $IpConfig
} elseif ($null -eq $nic.failover.Hypervisor.IpConfig -and $null -eq $vm.LiveIsDHCP -and $null -eq $vm.LiveIpAddress) { $nicSettings.failover.Hypervisor.DnsSuffix = $vm.LiveDnsSuffix
$nic.failover.Hypervisor.IpConfig = $null
} else {
$nic.failover.Hypervisor.IpConfig.IsDhcp = $vm.LiveIsDHCP
$nic.failover.Hypervisor.IpConfig.StaticIp = $vm.LiveIpAddress
$nic.failover.Hypervisor.IpConfig.SubnetMask = $vm.LiveIpSubnetMask
$nic.failover.Hypervisor.IpConfig.Gateway = $vm.LiveIpDefaultGateway
$nic.failover.Hypervisor.IpConfig.PrimaryDns = $vm.LivePrimaryDns
$nic.failover.Hypervisor.IpConfig.SecondaryDns = $vm.LiveSecondayDns
} }
$nic.failover.Hypervisor.DnsSuffix = $vm.LiveDnsSuffix $nicSettings.failoverTest.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.TestNetwork]
$nic.failoverTest.Hypervisor.NetworkIdentifier = $NetworkMap[$vm.TestNetwork] $nicSettings.failoverTest.Hypervisor.ShouldReplaceMacAddress = $vm.TestShouldReplaceMac
$nic.failoverTest.Hypervisor.ShouldReplaceMacAddress = $vm.TestShouldReplaceMac if ($vm.TestIsDHCP -imatch "true" ) {
if ($null -eq $nic.failoverTest.Hypervisor.IpConfig -and ($null -ne $vm.TestIsDHCP -or $null -ne $vm.TestIpAddress)) { $IpConfig = [PsCustomObject]@{
IsDhcp = $vm.TestIsDHCP
PrimaryDns = $vm.TestPrimaryDns
SecondaryDns = $vm.TestSecondayDns
}
$nicSettings.failoverTest.Hypervisor.IpConfig = $IpConfig
$nicSettings.failoverTest.Hypervisor.DnsSuffix = $vm.TestDnsSuffix
} elseif (($vm.TestIsDHCP -imatch "false" -or
[string]::IsNullOrWhiteSpace($vm.TestIsDHCP)) -and
-not [string]::IsNullOrWhiteSpace($vm.TestIpAddress)) {
$IpConfig = [PsCustomObject]@{ $IpConfig = [PsCustomObject]@{
IsDhcp = $vm.TestIsDHCP IsDhcp = $vm.TestIsDHCP
StaticIp = $vm.TestIpAddress StaticIp = $vm.TestIpAddress
@@ -84,24 +98,15 @@ function Import-ZertoVmNicSetting {
PrimaryDns = $vm.TestPrimaryDns PrimaryDns = $vm.TestPrimaryDns
SecondaryDns = $vm.TestSecondayDns SecondaryDns = $vm.TestSecondayDns
} }
$nic.failoverTest.Hypervisor.IpConfig = $IpConfig $nicSettings.failoverTest.Hypervisor.IpConfig = $IpConfig
} elseif ($null -eq $nic.failoverTest.Hypervisor.IpConfig -and $null -eq $vm.TestIsDHCP -and $null -eq $vm.TestIpAddress) { $nicSettings.failoverTest.Hypervisor.DnsSuffix = $vm.TestDnsSuffix
$nic.failoverTest.Hypervisor.IpConfig = $null }
} else { Write-Verbose "Putting Updated Config for VM: $($vm.name), NIC: $($nic.nicidentifier) in VPG: $Vpg"
$nic.failoverTest.Hypervisor.IpConfig.IsDhcp = $vm.TestIsDHCP if ($PSCmdlet.ShouldProcess($vm.NicIdentifier, "Updating Nic")) {
$nic.failoverTest.Hypervisor.IpConfig.StaticIp = $vm.TestIpAddress Invoke-ZertoRestRequest -uri $NicUri -Method "PUT" -Body ($nicSettings | ConvertTo-Json -Depth 10) > $null
$nic.failoverTest.Hypervisor.IpConfig.SubnetMask = $vm.TestIpSubnetMask
$nic.failoverTest.Hypervisor.IpConfig.Gateway = $vm.TestIpDefaultGateway
$nic.failoverTest.Hypervisor.IpConfig.PrimaryDns = $vm.TestPrimaryDns
$nic.failoverTest.Hypervisor.IpConfig.SecondaryDns = $vm.TestSecondayDns
} }
$nic.failoverTest.Hypervisor.DnsSuffix = $vm.TestDnsSuffix
} }
} }
Write-Verbose "Putting Updated Config for VM: $($vm.vmname) in Vpg: $Vpg"
if ($PSCmdlet.ShouldProcess($vm.NicIdentifier, "Updating Nic")) {
Invoke-ZertoRestRequest -uri $uri -Method "PUT" -Body ($VmNicSettings | ConvertTo-Json -Depth 10) > $null
}
} }
} }
Write-Verbose "Saving updated configuration for VPG: $Vpg" Write-Verbose "Saving updated configuration for VPG: $Vpg"
+146 -49
View File
@@ -1,72 +1,169 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #> <# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
#TODO - Add ability to installed with root password, Move to Begin, Process, End Format
function Install-ZertoVra { function Install-ZertoVra {
[cmdletbinding( SupportsShouldProcess = $true )] [cmdletbinding( SupportsShouldProcess )]
param( param(
[Parameter( Mandatory = $true, HelpMessage = "Host name where the VRA is to be installed." )] [Parameter(
Mandatory,
HelpMessage = "Host name where the VRA is to be installed."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$hostName, [string]$hostName,
[Parameter( Mandatory = $true, HelpMessage = "Datastore name where the VRA is to be installed." )] [Parameter(
Mandatory,
HelpMessage = "Datastore name where the VRA is to be installed."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$datastoreName, [string]$datastoreName,
[Parameter( Mandatory = $true, HelpMessage = "Network name the VRA is to be assigned." )] [Parameter(
Mandatory,
HelpMessage = "Network name the VRA is to be assigned."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$networkName, [string]$networkName,
[Parameter( HelpMessage = "Initial amount of memory to assign to the VRA in GB. Default is 3, Minimum is 1, Maximum is 16" )] [Parameter(
HelpMessage = "Initial amount of memory to assign to the VRA in GB. Default is 3, Minimum is 1, Maximum is 16"
)]
[ValidateRange(1, 16)] [ValidateRange(1, 16)]
[int]$memoryInGB = 3, [int]$memoryInGB = 3,
[Parameter( HelpMessage = "Bandwidth group to assign to the VRA. If unspecified will assign to the 'default_group'" )] [Parameter(
HelpMessage = "Bandwidth group to assign to the VRA. If unspecified will assign to the 'default_group'"
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$groupName, [string]$groupName,
[Parameter( ParameterSetName = "Dhcp", Mandatory = $true, HelpMessage = "Assign a DHCP address to the VRA." )] [Parameter(
ParameterSetName = "Dhcp",
Mandatory,
HelpMessage = "Assign a DHCP address to the VRA."
)]
[Parameter(
ParameterSetName = "DhcpWithRoot",
Mandatory,
HelpMessage = "Assign a DHCP address to the VRA."
)]
[switch]$Dhcp, [switch]$Dhcp,
[Parameter( ParameterSetName = "StaticIp", Mandatory = $true, HelpMessage = "Static IP address to assign to the VRA." )] [Parameter(
[ValidateScript( {$_ -match [IPAddress]$_ })] ParameterSetName = "StaticIp",
Mandatory,
HelpMessage = "Static IP address to assign to the VRA."
)]
[Parameter(
ParameterSetName = "StaticIpWithRoot",
Mandatory,
HelpMessage = "Static IP address to assign to the VRA."
)]
[ValidateScript( { $_ -match [IPAddress]$_ })]
[string]$vraIpAddress, [string]$vraIpAddress,
[Parameter( ParameterSetName = "StaticIp", Mandatory = $true, HelpMessage = "Default gateway to assign to the VRA" )] [Parameter(
[ValidateScript( {$_ -match [IPAddress]$_ })] ParameterSetName = "StaticIp",
Mandatory,
HelpMessage = "Default gateway to assign to the VRA"
)]
[Parameter(
ParameterSetName = "StaticIpWithRoot",
Mandatory,
HelpMessage = "Default gateway to assign to the VRA"
)]
[ValidateScript( { $_ -match [IPAddress]$_ })]
[string]$defaultGateway, [string]$defaultGateway,
[Parameter( ParameterSetName = "StaticIp", Mandatory = $true, HelpMessage = "Subnetmask to be assigned to the VRA" )] [Parameter(
[ValidateScript( {$_ -match [IPAddress]$_ })] ParameterSetName = "StaticIp",
[string]$subnetMask Mandatory,
HelpMessage = "Subnetmask to be assigned to the VRA"
)]
[Parameter(
ParameterSetName = "StaticIpWithRoot",
Mandatory,
HelpMessage = "Subnetmask to be assigned to the VRA"
)]
[ValidateScript( { $_ -match [IPAddress]$_ })]
[string]$subnetMask,
[Parameter(
ParameterSetName = "StaticIpWithRoot",
Mandatory,
HelpMessage = "Use this switch to install the VRA using the root password install method."
)]
[Parameter(
ParameterSetName = "DhcpWithRoot",
Mandatory,
HelpMessage = "Use this switch to install the VRA using the root password install method."
)]
[switch]$UseRootCredential,
[Parameter(
ParameterSetName = "StaticIpWithRoot",
Mandatory,
HelpMessage = "The password for the root user of the ESXi host where the VRA is to be installed."
)]
[Parameter(
ParameterSetName = "DhcpWithRoot",
Mandatory,
HelpMessage = "The password for the root user of the ESXi host where the VRA is to be installed."
)]
[ValidateNotNullOrEmpty()]
[securestring]$HostRootPassword
) )
# Build the VRA Name.
$vraName = "Z-VRA-{0}" -f $hostName
# 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
$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
# Build the JSON object through an Ordered Hashtable. begin {
$vraBasic = [ordered]@{}
$vraBasic['DatastoreIdentifier'] = $datastoreIdentifier.toString() }
if ($PSBoundParameters.ContainsKey('groupName')) { Process {
$vraBasic['GroupName'] = $groupName # Build the VRA Name.
} $vraName = "Z-VRA-{0}" -f $hostName
$vraBasic['HostIdentifier'] = $hostIdentifier.toString() # If the VRA does not exist, proceed with the installation. If it does exist, bypass and
$vraBasic['MemoryInGB'] = $memoryInGB if ( -not (Get-ZertoVra -vraName $vraName) ) {
$vraBasic['NetworkIdentifier'] = $networkIdentifier.toString() # Get identifiers for each item provided by name.
$vraBasic['UsePublicKeyInsteadOfCredentials'] = $true $siteIdentifier = $script:zvmLocalInfo.SiteIdentifier
$vraBasicNetwork = [ordered]@{} $hostIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -hosts | Where-Object { $_.VirtualizationHostName -eq $hostName } | Select-Object hostIdentifier -ExpandProperty hostIdentifier
if ( $PSCmdlet.ParameterSetName -eq "StaticIp" ) { $networkIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -networks | Where-Object { $_.VirtualizationNetworkName -eq $networkName } | Select-Object NetworkIdentifier -ExpandProperty NetworkIdentifier
$vraBasicNetwork['DefaultGateway'] = $defaultGateway.toString() $datastoreIdentifier = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -datastores | Where-Object { $_.DatastoreName -eq $datastoreName } | Select-Object DatastoreIdentifier -ExpandProperty DatastoreIdentifier
$vraBasicNetwork['SubnetMask'] = $subnetMask.toString() if ($datastoreIdentifier.count -gt 1) {
$vraBasicNetwork['VraIPAddress'] = $vraIpAddress.toString() $hostDevices = Get-ZertoVirtualizationSite -siteIdentifier $siteIdentifier -devices -hostIdentifier $hostIdentifier
$vraBasicNetwork['VraIPConfigurationTypeApi'] = "Static" $datastoreIdentifier = foreach ($identifier in $datastoreIdentifier) {
if ($identifier -in $hostDevices.DatastoreIdentifier) {
$identifier
}
}
if ($datastoreIdentifier.count -gt 1) {
Write-Error "Datastore $datastoreName has more than one identifier associated with it on the specified host. Please review and try again."
Break
}
}
# Build the JSON object through an Ordered Hashtable.
$vraBasic = [ordered]@{ }
$vraBasic['DatastoreIdentifier'] = $datastoreIdentifier.toString()
if ($PSBoundParameters.ContainsKey('groupName')) {
$vraBasic['GroupName'] = $groupName
}
$vraBasic['HostIdentifier'] = $hostIdentifier.toString()
$vraBasic['MemoryInGB'] = $memoryInGB
$vraBasic['NetworkIdentifier'] = $networkIdentifier.toString()
$vraBasic['UsePublicKeyInsteadOfCredentials'] = $true
$vraBasicNetwork = [ordered]@{ }
if ( $PSCmdlet.ParameterSetName -eq "StaticIp" -or $PSCmdlet.ParameterSetName -eq "StaticIpWithRoot") {
$vraBasicNetwork['DefaultGateway'] = $defaultGateway.toString()
$vraBasicNetwork['SubnetMask'] = $subnetMask.toString()
$vraBasicNetwork['VraIPAddress'] = $vraIpAddress.toString()
$vraBasicNetwork['VraIPConfigurationTypeApi'] = "Static"
} else {
$vraBasicNetwork['VraIPConfigurationTypeApi'] = "Dhcp"
}
$vraBasic['VraNetworkDataApi'] = $vraBasicNetwork
if ($PSCmdlet.ParameterSetName -eq "StaticIpWithRoot" -or $PSCmdlet.ParameterSetName -eq "DhcpWithRoot") {
$HostRootCredential = [pscredential]::new('root', $HostRootPassword)
$vraBasic['UsePublicKeyInsteadOfCredentials'] = $false
$vraBasic['HostRootPassword'] = $HostRootCredential.GetNetworkCredential().Password
}
# Leverage WhatIf functionality to see what might happen, if WhatIf is not specified, attempt to install.
if ($PSCmdlet.ShouldProcess($hostName)) {
Invoke-ZertoRestRequest -uri "vras" -method POST -body $($vraBasic | ConvertTo-Json)
}
} else { } else {
$vraBasicNetwork['VraIPConfigurationTypeApi'] = "Dhcp" Write-Error "Host $hostName already has a VRA installed. Aborting Install Call"
} }
$vraBasic['VraNetworkDataApi'] = $vraBasicNetwork }
End {
# Leverage WhatIf functionality to see what might happen, if WhatIf is not specified, attempt to install.
if ($PSCmdlet.ShouldProcess("Preforming operation 'Install-Vra' on Host $hostName with the following data \n $($vraBasic | convertto-json)")) {
Invoke-ZertoRestRequest -uri "vras" -method POST -body $($vraBasic | ConvertTo-Json)
}
} else {
Write-Error "Host $hostName already has a VRA installed. Aborting Install Call"
} }
} }
@@ -1,26 +1,38 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZARestRequest { function Invoke-ZARestRequest {
[cmdletbinding()] [cmdletbinding()]
param( param(
# Parameter help description # Parameter help description
[Parameter(Mandatory)] [Parameter(
Mandatory,
Helpmessage = "URI endpoint to be utilized. When submitting the URI, only the endpoint needs to be submitted. Please review the help documentation for examples."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$uri, [string]$uri,
[Parameter(
Helpmessage = "API method to be used. GET, PUT, POST, or DELETE. Refer to documentation for the API endpoint to ensure the correct method is being used. If unspecified, defaults to GET"
)]
[ValidateSet("GET", "PUT", "POST", "DELETE")] [ValidateSet("GET", "PUT", "POST", "DELETE")]
[string]$method = "GET", [string]$method = "GET",
[Parameter(
Helpmessage = "Body to be submitted to the REST API endpoint. This needs to be submitted in JSON format"
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$body, [string]$body
[ValidateNotNullOrEmpty()]
[string]$contentType = "application/json"
) )
# While the API can use XML or JSON, this module is built on JSON functionality. Currently forcing all
# content types and language to JSON.
[string]$contentType = "application/json"
# Check to see if the required variables are present and currently valid # Check to see if the required variables are present and currently valid
if ( -not ((Test-Path variable:script:zaLastActionTime) -and (Test-Path variable:script:zaHeaders)) ) { if ( -not ((Test-Path variable:script:zaLastActionTime) -and (Test-Path variable:script:zaHeaders)) ) {
Throw "Zerto Analytics Connection does not Exist. Please run Connect-ZertoAnalytics first to establish a connection" Throw "Zerto Analytics Connection does not Exist. Please run Connect-ZertoAnalytics first to establish a connection"
} elseif ( (Test-Path variable:script:zaHeaders) -and $([datetime]$script:zaLastActionTime).addMinutes(60) -lt $(get-date) ) { } elseif ( (Test-Path variable:script:zaHeaders) -and $([datetime]$script:zaLastActionTime).addMinutes(60) -lt $(Get-Date) ) {
Throw "Authorization Token has Expired. Please re-authorize to the Zerto Analytics Portal" Throw "Authorization Token has Expired. Please re-authorize to the Zerto Analytics Portal"
} else { } else {
# Update the last action time and submit the request based on PS Version. # Update the last action time and submit the request based on PS Version.
Set-Variable -Name zaLastActionTime -Scope Script -Value $(Get-date).Ticks Set-Variable -Name zaLastActionTime -Scope Script -Value $(Get-Date).Ticks
$submittedUri = "https://analytics.api.zerto.com/v2/{0}" -f $uri $submittedUri = "https://analytics.api.zerto.com/v2/{0}" -f $uri
if ($PSVersionTable.PSVersion.Major -ge 6) { if ($PSVersionTable.PSVersion.Major -ge 6) {
Invoke-RestMethod -Uri $submittedUri -Method $method -Body $body -Headers $Script:zaHeaders -ContentType $contentType -TimeoutSec 100 Invoke-RestMethod -Uri $submittedUri -Method $method -Body $body -Headers $Script:zaHeaders -ContentType $contentType -TimeoutSec 100
@@ -0,0 +1,62 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZertoEvacuateVra {
[CmdletBinding(SupportsShouldProcess, DefaultParameterSetName = "VraIdentifier")]
param (
# HostName Option
[Parameter(
Mandatory,
HelpMessage = "Name of the Host to Evacuate",
ParameterSetName = "HostName"
)]
[ValidateNotNullOrEmpty()]
[String]$HostName,
# VRA Option
[Parameter(
Mandatory,
HelpMessage = "Name of the VRA to Evacuate",
ParameterSetName = "VraName"
)]
[ValidateNotNullOrEmpty()]
[String]$VraName,
# VRAIdentifier Option
[Parameter(
Mandatory,
HelpMessage = "Identifier of the VRA to be evacuated",
ParameterSetName = "VraIdentifier",
ValueFromPipelineByPropertyName,
ValueFromPipeline
)]
[Alias("VraId", "Identifier")]
[ValidateNotNullOrEmpty()]
[String]$VraIdentifier
)
begin {
}
process {
switch ($PSCmdlet.ParameterSetName) {
"HostName" {
$VraName = "Z-VRA-" + $HostName
Invoke-ZertoEvacuateVra -VraName $VraName
}
"VraName" {
$VraIdentifier = (Get-ZertoVra -vraName $VraName).VraIdentifier
Invoke-ZertoEvacuateVra -VraIdentifier $VraIdentifier
}
"VraIdentifier" {
$Uri = "vras/{0}/changerecoveryvra/execute" -f $VraIdentifier
if ($PSCmdlet.ShouldProcess($VraIdentifier, "Evacuating VRA with Identifier:")) {
Invoke-ZertoRestRequest -Uri $Uri -Method "POST"
}
}
}
}
end {
}
}
+1 -1
View File
@@ -89,7 +89,7 @@ function Invoke-ZertoMove {
Write-Error "VPG: $name not found. Please check the name and try again. Skipping" Write-Error "VPG: $name not found. Please check the name and try again. Skipping"
} else { } else {
$uri = "{0}/{1}/move" -f $baseUri, $vpgId $uri = "{0}/{1}/move" -f $baseUri, $vpgId
if ($PSCmdlet.ShouldProcess("Moving VPG: $name wiht settings: $($body | convertto-json)")) { if ($PSCmdlet.ShouldProcess("Moving VPG: $name with settings: $($body | convertto-json)")) {
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json) Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
} }
} }
@@ -1,20 +1,39 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Invoke-ZertoRestRequest { function Invoke-ZertoRestRequest {
[cmdletbinding()] [cmdletbinding()]
param( param(
# Parameter help description
[Parameter(
Helpmessage = "API method to be used. GET, PUT, POST, or DELETE. Refer to documentation for the API endpoint to ensure the correct method is being used. If unspecified, defaults to GET"
)]
[ValidateSet("GET", "PUT", "POST", "DELETE")] [ValidateSet("GET", "PUT", "POST", "DELETE")]
[string]$method = "GET", [string]$method = "GET",
[Parameter(Mandatory)] [Parameter(
Mandatory,
Helpmessage = "URI endpoint to be utilized. When submitting the URI, only the endpoint needs to be submitted. Please review the help documentation for examples."
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$uri, [string]$uri,
[ValidateNotNullOrEmpty()] [Parameter(
[string]$apiVersion = "v1", Helpmessage = "Body to be submitted to the REST API endpoint. This needs to be submitted in JSON format"
)]
[ValidateNotNullOrEmpty()] [ValidateNotNullOrEmpty()]
[string]$body, [string]$body,
[ValidateNotNullOrEmpty()] [Parameter(
[string]$contentType = "application/json", Helpmessage = "PSCredential object. This is ONLY used when authenticating with the ZVM. No other endpoints require this and generally is not used."
)]
[PSCredential]$credential, [PSCredential]$credential,
[Parameter(
Helpmessage = "Use this switch if you would like the request headers returned along with the body. Useful for troubleshooting to get HTTP error codes."
)]
[switch]$returnHeaders [switch]$returnHeaders
) )
# API version. Currently this is locked at v1 in all versions of Zerto. Should this change, will look
# at making this as parameter to be selected during function call.
$apiVersion = "v1"
# While the API can use XML or JSON, this module is built on JSON functionality. Currently forcing all
# content types and language to JSON.
$contentType = "application/json"
$callerErrorActionPreference = $ErrorActionPreference $callerErrorActionPreference = $ErrorActionPreference
# If the ZVM server and Port not defined, Stop Call # If the ZVM server and Port not defined, Stop Call
if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) { if ( -not ((Test-Path variable:script:zvmServer) -and (Test-Path variable:script:zvmPort)) ) {
@@ -22,7 +41,7 @@ function Invoke-ZertoRestRequest {
} }
# If the Headers exist and the Last action was more than 30 minutes ago, Session is Expired # 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) ) {
Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager" Throw "Authorization Token has Expired. Please re-authorize to the Zerto Virtual Manager"
} else { } else {
@@ -30,7 +49,7 @@ function Invoke-ZertoRestRequest {
$submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri $submittedURI = "https://{0}:{1}/{2}/{3}" -f $script:zvmServer, $script:zvmPort, $apiVersion, $uri
try { try {
# Set the zvmLastAction time and try to submit the REST Request # Set the zvmLastAction time and try to submit the REST Request
$script:zvmLastAction = (get-date).Ticks $script:zvmLastAction = (Get-Date).Ticks
# If running PwSh - Use this Invoke-RestMethod with passed Variables # If running PwSh - Use this Invoke-RestMethod with passed Variables
if ($PSVersionTable.PSVersion.Major -ge 6) { 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 $apiRequestResults = Invoke-RestMethod -Uri $submittedURI -Headers $script:zvmHeaders -Method $method -Body $body -ContentType $contentType -Credential $credential -SkipCertificateCheck -ResponseHeadersVariable responseHeaders -TimeoutSec 100
@@ -0,0 +1,23 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function New-ZertoPairingToken {
[CmdletBinding(SupportsShouldProcess = $true)]
param (
)
begin {
}
process {
$uri = "peersites/generatetoken"
$body = @{ }
if ($PSCmdlet.ShouldProcess("Obtaining Pairing token from $script:zvmServer")) {
Invoke-ZertoRestRequest -uri $uri -method "POST" -body $($body | ConvertTo-Json)
}
}
end {
}
}
@@ -0,0 +1,35 @@
<# .ExternalHelp ./en-us/ZertoApiWrapper-help.xml #>
function Set-ZertoUserCredential {
[cmdletbinding(
SupportsShouldProcess,
ConfirmImpact = 'High'
)]
param(
[Parameter(
HelpMessage = "PSCredential Object that contains the username and password for the updated credentials.",
Mandatory
)]
[pscredential]$UserCredential
)
begin {
}
process {
$uri = '/localsite/virtualizationsettings'
$body = @{
Credentials = @{
UserName = $UserCredential.UserName
Password = $UserCredential.GetNetworkCredential().Password
}
}
if ( $PSCmdlet.ShouldProcess( $script:zvmServer, "Updating hypervisor service account credentials" )) {
Invoke-ZertoRestRequest -uri $uri -Method PUT -body ($body | ConvertTo-Json)
}
}
end {
}
}
@@ -27,11 +27,12 @@ function Start-ZertoFailoverTest {
if ( -not $vpgIdentifier) { if ( -not $vpgIdentifier) {
Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop
} }
$body = @{ }
if ( $PSBoundParameters.ContainsKey('vmName') ) { if ( $PSBoundParameters.ContainsKey('vmName') ) {
$vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName
[System.Collections.ArrayList]$vmIdentifiers = @() $vmIdentifiers = [System.Collections.Generic.List[string]]::new()
foreach ( $name in $vmName ) { foreach ( $name in $vmName ) {
$selectedVm = $vpgVmInformation | Where-Object {$_.VmName.toLower() -eq $name.toLower()} $selectedVm = $vpgVmInformation | Where-Object { $_.VmName.toLower() -eq $name.toLower() }
if ($null -eq $selectedVm) { if ($null -eq $selectedVm) {
Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop
} elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) {
+8 -8
View File
@@ -18,11 +18,11 @@ pr:
jobs: jobs:
# Windows PowerShell 5.1 Build Job # Windows PowerShell 5.1 Build Job
- job: Build_PS_Win2016 - job: Build_PS_Windows
timeoutInMinutes: 10 timeoutInMinutes: 10
cancelTimeoutInMinutes: 2 cancelTimeoutInMinutes: 2
pool: pool:
vmImage: vs2017-win2016 vmImage: windows-latest
steps: steps:
# Run build.ps1 script in PowerShell Core # Run build.ps1 script in PowerShell Core
- powershell: | - powershell: |
@@ -46,11 +46,11 @@ jobs:
# Windows PowerShell Core Build Job # Windows PowerShell Core Build Job
- job: Build_PSCore_Win2016 - job: Build_PSCore_Windows
timeoutInMinutes: 10 timeoutInMinutes: 10
cancelTimeoutInMinutes: 2 cancelTimeoutInMinutes: 2
pool: pool:
vmImage: vs2017-win2016 vmImage: windows-latest
steps: steps:
# Run build.ps1 script in PowerShell Core # Run build.ps1 script in PowerShell Core
- pwsh: | - pwsh: |
@@ -73,11 +73,11 @@ jobs:
condition: always() condition: always()
# Linux Build Job # Linux Build Job
- job: Build_PSCore_Ubuntu1604 - job: Build_PSCore_Ubuntu
timeoutInMinutes: 10 timeoutInMinutes: 10
cancelTimeoutInMinutes: 2 cancelTimeoutInMinutes: 2
pool: pool:
vmImage: ubuntu-16.04 vmImage: ubuntu-latest
steps: steps:
# Run build.ps1 script in PowerShell Core # Run build.ps1 script in PowerShell Core
- pwsh: | - pwsh: |
@@ -112,11 +112,11 @@ jobs:
condition: always() condition: always()
# MacOS Build Job # MacOS Build Job
- job: Build_PSCore_MacOS1013 - job: Build_PSCore_MacOS
timeoutInMinutes: 10 timeoutInMinutes: 10
cancelTimeoutInMinutes: 2 cancelTimeoutInMinutes: 2
pool: pool:
vmImage: xcode9-macos10.13 vmImage: macOS-latest
steps: steps:
# Run build.ps1 script in PowerShell Core # Run build.ps1 script in PowerShell Core
- pwsh: | - pwsh: |
+26 -3
View File
@@ -13,7 +13,8 @@ Pairs the current Zerto Virtual Manager to the target Zerto Virtual Manager
## SYNTAX ## SYNTAX
``` ```
Add-ZertoPeerSite [-targetHost] <String> [[-targetPort] <Int32>] [-WhatIf] [-Confirm] [<CommonParameters>] Add-ZertoPeerSite [-targetHost] <String> [[-targetPort] <Int32>] [-token <String>] [-WhatIf] [-Confirm]
[<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@@ -23,10 +24,17 @@ Pairs the current Zerto Virtual Manager to the target Zerto Virtual Manager by l
### Example 1 ### Example 1
```powershell ```powershell
PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -targetPort "9081" PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100"
``` ```
Pairs the current Zerto Virtual Manager to the Zerto Virtual Manager at IP address 192.168.2.100. 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 prior to version 7.5
### Example 2
```powershell
PS C:\> Add-ZertoPeerSite -targetHost "192.168.2.100" -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.
## PARAMETERS ## PARAMETERS
@@ -61,6 +69,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -token
The generated token from the destination site. Note: This is only supported when both sites support pairing authentication. This was implemented to support ZVR 7.5 and later.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Confirm ### -Confirm
Prompts you for confirmation before running the cmdlet. Prompts you for confirmation before running the cmdlet.
+3 -3
View File
@@ -13,7 +13,7 @@ Add a tagged checkpoint to a specified VPG
## SYNTAX ## SYNTAX
``` ```
Checkpoint-ZertoVpg [-vpgName] <String> [-checkpointName] <String> [<CommonParameters>] Checkpoint-ZertoVpg [-vpgName] <String[]> [-checkpointName] <String> [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@@ -49,14 +49,14 @@ Accept wildcard characters: False
Name of the VPG to tag. Name of the VPG to tag.
```yaml ```yaml
Type: String Type: String[]
Parameter Sets: (All) Parameter Sets: (All)
Aliases: Aliases:
Required: True Required: True
Position: 0 Position: 0
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False Accept wildcard characters: False
``` ```
+2
View File
@@ -106,5 +106,7 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## RELATED LINKS ## 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) [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) [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) [Get-Credential Documentation](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.security/get-credential?view=powershell-6)
+127
View File
@@ -0,0 +1,127 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Copy-ZertoVpg.md
schema: 2.0.0
---
# Copy-ZertoVpg
## SYNOPSIS
Copy an existing VPG settings object to create a new VPG with the same settings. New VMs must be added to the copied VPG.
## SYNTAX
```
Copy-ZertoVpg [-SourceVpgName] <String> [-NewVpgName] <String> [-VMs] <String[]> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
## DESCRIPTION
Copy an existing VPG settings object to create a new VPG with the same settings. New VMs must be added to the copied VPG.
## EXAMPLES
### Example 1
```powershell
PS C:\> Copy-ZertoVpg -SourceVpgName 'MyVpg' -NewVpgName 'MyNewVpg' -VMs 'VmToAdd01'
```
Copies the settings of 'MyVpg' into a new VPG 'MyNewVpg' adding one VM, 'VmToAdd01'
### Example 2
```powershell
PS C:\> Copy-ZertoVpg -SourceVpgName 'MyVpg' -NewVpgName 'MyNewVpg' -VMs 'VmToAdd01', 'VmToAdd02'
```
Copies the settings of 'MyVpg' into a new VPG 'MyNewVpg' adding two VMs, 'VmToAdd01' and 'VmToAdd02'
## PARAMETERS
### -NewVpgName
Name to assign the newly created VPG
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SourceVpgName
Name of the VPG to clone
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -VMs
Name of VMs to add to the VPG
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Clone VPG API Endpoint 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.119.html%23)
+27 -3
View File
@@ -8,13 +8,13 @@ schema: 2.0.0
# Edit-ZertoVra # Edit-ZertoVra
## SYNOPSIS ## SYNOPSIS
Updates a VRA with updated settings Updates a VRA with updated settings. Use of this function will cause a reboot of the associated VRA.
## SYNTAX ## SYNTAX
``` ```
Edit-ZertoVra -vraIdentifier <String> [-groupName <String>] [-vraIpAddress <String>] [-defaultGateway <String>] Edit-ZertoVra -vraIdentifier <String> [-groupName <String>] [-vraIpAddress <String>] [-defaultGateway <String>]
[-subnetMask <String>] [-WhatIf] [-Confirm] [<CommonParameters>] [-subnetMask <String>] [-HostRootPassword <SecureString>] [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@@ -24,6 +24,8 @@ It is possible to update the Bandwidth group with the -groupName setting. If the
It is possible to update the static IP address, default gateway, or subnetmask. It is possible to update the static IP address, default gateway, or subnetmask.
This function can be used if the VRA was installed with host credentials to update the password to connect to the host if it has changed.
It is suggested that you use Get-ZertoVra to get the vraIdentifer parameter. It is suggested that you use Get-ZertoVra to get the vraIdentifer parameter.
## EXAMPLES ## EXAMPLES
@@ -49,13 +51,20 @@ PS C:\>Edit-ZertoVra -vraIdentifier $vraIdentifier -vraIpAddress "192.168.1.101"
Updates the VRA IP address to 192.168.1.101, subnet mask to 255.255.252.0, and default gateway to 192.168.1.1 Updates the VRA IP address to 192.168.1.101, subnet mask to 255.255.252.0, and default gateway to 192.168.1.1
### Example 3 ### Example 4
```powershell ```powershell
PS C:\>Edit-ZertoVra -vraIdentifier $vraIdentifier -defaultGateway "192.168.1.1" PS C:\>Edit-ZertoVra -vraIdentifier $vraIdentifier -defaultGateway "192.168.1.1"
``` ```
Updates the VRA default gateway to 192.168.1.1 Updates the VRA default gateway to 192.168.1.1
### Example 5
```powershell
PS C:\>Edit-ZertoVra -HostRootPassword $HostRootPassword
```
Updates the VRA default gateway to 192.168.1.1
## PARAMETERS ## PARAMETERS
### -defaultGateway ### -defaultGateway
@@ -89,6 +98,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -HostRootPassword
Updated ESXi host root password.
```yaml
Type: SecureString
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -subnetMask ### -subnetMask
Subnetmask to be assigned to the VRA Subnetmask to be assigned to the VRA
+163
View File
@@ -0,0 +1,163 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerJournalSizeReport.md
schema: 2.0.0
---
# Get-ZAPlannerJournalSizeReport
## SYNOPSIS
Create a report request to retrieve the Journal Size for a specific VMs list, and timeframe.
## SYNTAX
```
Get-ZAPlannerJournalSizeReport [-siteIdentifier] <String> [-recoveryType] <String> [-vmIdentifier] <String[]>
[[-desiredJournalHistory] <Int32>] [[-startDate] <String>] [[-endDate] <String>] [<CommonParameters>]
```
## DESCRIPTION
Create a report request to retrieve the Journal Size for a specific VMs list, and timeframe.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2'
```
Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 24 hours. This will use all data contained in Zerto Analytics to create the Journal report.
### Example 2
```powershell
PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -desiredJournalHistory 96
```
Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 96 hours (4 days). This will use all data contained in Zerto Analytics to create the Journal report.
### Example 3
```powershell
PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -desiredJournalHistory 96 -startDate '2020-01-01'
```
Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 96 hours (4 days). This will use all data starting from Jan 1st to today contained in Zerto Analytics to create the Journal report.
### Example 4
```powershell
PS C:\> Get-ZAPlannerJournalSizeReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -desiredJournalHistory 96 -startDate '2020-01-01' -endDate '2020-01-30'
```
Gets a Journal report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. The report will cover a Journal History of 96 hours (4 days). This will use all data starting from Jan 1st to Jan 30th contained in Zerto Analytics to create the Journal report.
## PARAMETERS
### -desiredJournalHistory
The desired journal history in hours.
The default is 24 hours.
Limited to a 1 hour up to 720 hours, or the equivalent of 30 days
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 24
Accept pipeline input: False
Accept wildcard characters: False
```
### -endDate
The latest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is the current time.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -recoveryType
Type of target recovery site.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -siteIdentifier
The site identifier(s) for which to return detailed information.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -startDate
The earliest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is one year ago.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vmIdentifier
Identifiers of the VMs you want to recover at the target recovery site.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Planner Journal Size Report - Post](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats_journal_size)
[Zerto Planner Journal Size Report - Get](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats_journal_size)
@@ -0,0 +1,158 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerNetworkPerformanceReport.md
schema: 2.0.0
---
# Get-ZAPlannerNetworkPerformanceReport
## SYNOPSIS
Create a report request to retrieve the Network Performance for a specific VMs list, and timeframe.
## SYNTAX
```
Get-ZAPlannerNetworkPerformanceReport [-siteIdentifier] <String> [-recoveryType] <String>
[-vmIdentifier] <String[]> [[-interval] <Int32>] [[-startDate] <String>] [[-endDate] <String>]
[<CommonParameters>]
```
## DESCRIPTION
Create a report request to retrieve the Network Performance for a specific VMs list, and timeframe.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAPlannerNetworkPerformanceReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2'
```
Gets a Network Performance report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. This will use all data contained in Zerto Analytics to create the Journal report.
### Example 2
```powershell
PS C:\> Get-ZAPlannerNetworkPerformanceReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -startDate '2020-01-01' -interval 86400
```
Gets a Network Performance report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. This will use data contained in Zerto Analytics starting Jan 1st, 2020 ending on the day the report is run to create the Journal report. Sample reporting interval will be 86400 seconds (1 day).
### Example 3
```powershell
PS C:\> Get-ZAPlannerNetworkPerformanceReport -siteIdentifier '1234567890-01923141' -recoveryType VMware -vmIdentifier 'vmIdentifier1', 'vmIdentifier2' -startDate '2020-01-01' -endDate '2020-01-30' -interval 86400
```
Gets a Network Performance report for VMs with identifiers 'vmIdentifier1' and 'vmIdentifier2' at source siteIdentifier '1234567890-01923141' where the target recovery location is VMware. This will use data contained in Zerto Analytics starting Jan 1st, 2020 ending on Jan 30th, 2020 to create the Journal report. Sample reporting interval will be 86400 seconds (1 day).
## PARAMETERS
### -endDate
The latest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is the current time.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -interval
The desired sample interval in seconds.
The default is 3600 seconds (1 Hour).
Limited to a 60 second to 86,400 second (24 Hour) interval
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 3600
Accept pipeline input: False
Accept wildcard characters: False
```
### -recoveryType
Type of target recovery site.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -siteIdentifier
The site identifier(s) for which to return detailed information.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -startDate
The earliest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is one year ago.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vmIdentifier
Identifiers of the VMs you want to recover at the target recovery site.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Planner Network-Performance API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_network_performance)
[Zerto Analytics Planner Network-Performance API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_network_performance)
+67
View File
@@ -0,0 +1,67 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerSite.md
schema: 2.0.0
---
# Get-ZAPlannerSite
## SYNOPSIS
Retrieve all active Planner sites for a specific account - includes ID, Name and Type or retrieves datacenter, host, and VMs for a specific site.
## SYNTAX
```
Get-ZAPlannerSite [[-siteIdentifier] <String[]>] [<CommonParameters>]
```
## DESCRIPTION
Retrieve all active Planner sites for a specific account - includes ID, Name and Type or retrieves datacenter, host, and VMs for a specific site.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAPlannerSite
```
Retrieve all active Planner sites for a specific account
### Example 2
```powershell
PS C:\> Get-ZAPlannerSite -siteIdentifier '0123-45676-09876'
```
Retrieves datacenter, host, and VMs for site with Identifier '0123-45676-09876'.
## PARAMETERS
### -siteIdentifier
The site identifier(s) for which to return detailed information.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Sites Planner Endpoint](https://docs.api.zerto.com/#/Planner/get_v2_planner_sites)
[Zerto Analytics Single Site Planner Endpoint](https://docs.api.zerto.com/#/Planner/get_v2_planner_sites__siteIdentifier_)
+149
View File
@@ -0,0 +1,149 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerStatsReport.md
schema: 2.0.0
---
# Get-ZAPlannerStatsReport
## SYNOPSIS
Create a report request for the selected VMs for a specific timeframe, retrieving all stats data for ZCAs, WAN, Journal size and array of VMs avg IOPs, avg throughput and journal size.
## SYNTAX
```
Get-ZAPlannerStatsReport [-siteIdentifier] <String> [-recoveryType] <String> [-vmIdentifier] <String[]>
[[-desiredJournalHistory] <Int32>] [[-startDate] <String>] [[-endDate] <String>] [<CommonParameters>]
```
## DESCRIPTION
Create a report request for the selected VMs for a specific timeframe, retrieving all stats data for ZCAs, WAN, Journal size and array of VMs avg IOPs, avg throughput and journal size.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAPlannerStatsReport -siteIdentifier '0123-45676-09876' -recoveryType vcenter -vmIdentifier 'vmIdentifier01', 'vmIdentifier02'
```
Will get a stats report for the two VMs listed recovering to a vCenter site with a 24 hour journal
### Example 2
```powershell
PS C:\> Get-ZAPlannerStatsReport -siteIdentifier '0123-45676-09876' -recoveryType Azure -vmIdentifier 'vmIdentifier01', 'vmIdentifier02' -desiredJournalHistory 72
```
Will get a stats report for the two VMs listed recovering to an Azure site with a 72 hour journal
## PARAMETERS
### -desiredJournalHistory
The desired journal history in hours.
The default is 24 hours.
Limited to a 1 hour up to 720 hours, or the equivalent of 30 days
```yaml
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: 24
Accept pipeline input: False
Accept wildcard characters: False
```
### -endDate
The latest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is the current time.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -recoveryType
Type of target recovery site.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -siteIdentifier
The site identifier(s) for which to return detailed information.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -startDate
The earliest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is one year ago.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vmIdentifier
Identifiers of the VMs you want to recover at the target recovery site.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Planner Stats API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats)
[Zerto Analytics Planner Stats API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats)
+125
View File
@@ -0,0 +1,125 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerWanReport.md
schema: 2.0.0
---
# Get-ZAPlannerWanReport
## SYNOPSIS
Create a report request to retrieve WAN for a specific VMs list, and timeframe.
## SYNTAX
```
Get-ZAPlannerWanReport [-siteIdentifier] <String> [-recoveryType] <String> [-vmIdentifier] <String[]>
[[-startDate] <String>] [[-endDate] <String>] [<CommonParameters>]
```
## DESCRIPTION
Create a report request to retrieve WAN for a specific VMs list, and timeframe.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAPlannerWanReport -siteIdentifier '12345-0987654-254364' -recoveryType vcenter -vmIdentifier '1234-98789-0987', '1234-98789-1252'
```
Get a WAN requirements report for VMs at the protected site.
## PARAMETERS
### -endDate
The latest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is the current time.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -recoveryType
Type of target recovery site.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -siteIdentifier
The site identifier(s) for which to return detailed information.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -startDate
The earliest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is one year ago.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vmIdentifier
Identifiers of the VMs you want to recover at the target recovery site.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Planner Wan Stats API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats_wan)
[Zerto Analytics Planner Wan Stats API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats_wan)
+125
View File
@@ -0,0 +1,125 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAPlannerZcasReport.md
schema: 2.0.0
---
# Get-ZAPlannerZcasReport
## SYNOPSIS
Create a report request to retrieve ZCAs for a specific VMs list, and timeframe.
## SYNTAX
```
Get-ZAPlannerZcasReport [-siteIdentifier] <String> [-recoveryType] <String> [-vmIdentifier] <String[]>
[[-startDate] <String>] [[-endDate] <String>] [<CommonParameters>]
```
## DESCRIPTION
Create a report request to retrieve ZCAs for a specific VMs list, and timeframe.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAPlannerZcasReport -siteIdentifier '12345-0987654-254364' -recoveryType azure -vmIdentifier '1234-98789-0987', '1234-98789-1252'
```
Get a report for the number of required ZCA's in Azure to protect the supplied VMs.
## PARAMETERS
### -endDate
The latest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is the current time.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -recoveryType
Type of target recovery site.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -siteIdentifier
The site identifier(s) for which to return detailed information.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -startDate
The earliest timestamp of an event to return, in RFC 3339 standard.
('1970-01-01T00:00:00Z').
The default is one year ago.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vmIdentifier
Identifiers of the VMs you want to recover at the target recovery site.
```yaml
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 3
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Planner ZCA Stats API Endpoint - POST](https://docs.api.zerto.com/#/Planner/post_v2_planner_reports_stats_zcas)
[Zerto Analytics Planner ZCA Stats API Endpoint - GET](https://docs.api.zerto.com/#/Planner/get_v2_planner_reports_stats_zcas)
+120
View File
@@ -0,0 +1,120 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVm.md
schema: 2.0.0
---
# Get-ZAProtectedVm
## SYNOPSIS
Gets information about currently protected Virtual Machines in all sites. If desired a subset of VMs can be returned by providing VM Identifiers for each virtual machine.
## SYNTAX
### AllVMs (Default)
```
Get-ZAProtectedVm [-AllVms] [<CommonParameters>]
```
### IndividualVMs
```
Get-ZAProtectedVm -VMIdentifier <String[]> [-Volumes] [<CommonParameters>]
```
## DESCRIPTION
Gets information about currently protected Virtual Machines in all sites. If desired a subset of VMs can be returned by providing VM Identifiers for each virtual machine. Finally, when gathering information for individual virtual machines, the `-Volumes` parameter can be specified to return volume information for the protected VM.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAProtectedVm
```
Returns all protected virtual machines across all sites.
### Example 2
```powershell
PS C:\> Get-ZAProtectedVm -AllVMs
```
Returns all protected virtual machines across all sites.
### Example 3
```powershell
PS C:\> Get-ZAProtectedVm -VMIdentifier '09914-12345-12341235', '81238-12532-12355332'
```
Returns information for only the two specified virtual machines
### Example 4
```powershell
PS C:\> Get-ZAProtectedVm -VMIdentifier '09914-12345-12341235', '81238-12532-12355332' -Volumes
```
Returns volume information for the two specified virtual machines
## PARAMETERS
### -AllVms
Use this switch when you want a list of all protected VMs.
Please be warned this list can be quite large.
```yaml
Type: SwitchParameter
Parameter Sets: AllVMs
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -VMIdentifier
A list of VM identifiers to query
```yaml
Type: String[]
Parameter Sets: IndividualVMs
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -Volumes
Specify this switch when you would like protected vms' volume information returned
```yaml
Type: SwitchParameter
Parameter Sets: IndividualVMs
Aliases:
Required: False
Position: Named
Default value: False
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Protected VMs API Endpoint - AllVMs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms)
[Zerto Analytics Protected VMs API Endpoint - List of VMs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms__vmIdentifier_)
[Zerto Analytics Protected VMs API Endpoint - Volumes of VMs](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms__vmIdentifier__volumes)
+60
View File
@@ -0,0 +1,60 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZAProtectedVmReport.md
schema: 2.0.0
---
# Get-ZAProtectedVmReport
## SYNOPSIS
Creates a report of the requested protected virtual machines' volumes.
## SYNTAX
```
Get-ZAProtectedVmReport -VMIdentifier <String[]> [<CommonParameters>]
```
## DESCRIPTION
Creates a report of the requested protected virtual machines' volumes.
## EXAMPLES
### Example 1
```powershell
PS C:\> Get-ZAProtectedVmReport -VMIdentifier '09914-12345-12341235', '81238-12532-12355332'
```
Generates a protected vm report for the virtual machines with the specified VMIdentifiers.
## PARAMETERS
### -VMIdentifier
A list of VM identifiers to include in the report.
```yaml
Type: String[]
Parameter Sets: (All)
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics Protected VMs Report API Endpoint - POST](https://docs.api.zerto.com/#/Monitoring/post_v2_monitoring_protected_vms)
[Zerto Analytics Protected VMs Report API Endpoint - GET](https://docs.api.zerto.com/#/Monitoring/get_v2_monitoring_protected_vms_reportId__reportId_)
+1 -17
View File
@@ -20,7 +20,7 @@ Get-ZertoRecoveryReport [<CommonParameters>]
### filter ### filter
``` ```
Get-ZertoRecoveryReport [-startTime <String>] [-endTime <String>] [-pageNumber <String>] [-pageSize <String>] Get-ZertoRecoveryReport [-startTime <String>] [-endTime <String>] [-pageNumber <String>] [-pageSize <String>]
[-vpgIdentifier <String>] [-vpgName <String>] [-recoveryType <String>] [-state <String>] [<CommonParameters>] [-vpgName <String>] [-recoveryType <String>] [-state <String>] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@@ -142,22 +142,6 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -vpgIdentifier
The internal identifier of the VPG.
You can specify more than one VPG, separated by commas.
```yaml
Type: String
Parameter Sets: filter
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -vpgName ### -vpgName
The name of the VPG. The name of the VPG.
You can specify more than one VPG, separated by commas. You can specify more than one VPG, separated by commas.
+22 -2
View File
@@ -18,6 +18,11 @@ Returns information about the hypervisor site where the API is run and all the s
Get-ZertoVirtualizationSite [<CommonParameters>] Get-ZertoVirtualizationSite [<CommonParameters>]
``` ```
### repositories
```
Get-ZertoVirtualizationSite -siteIdentifier <String> [-repositories] [<CommonParameters>]
```
### folders ### folders
``` ```
Get-ZertoVirtualizationSite -siteIdentifier <String> [-folders] [<CommonParameters>] Get-ZertoVirtualizationSite -siteIdentifier <String> [-folders] [<CommonParameters>]
@@ -225,6 +230,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -repositories
The identifier of the Zerto Virtual Manager site.
```yaml
Type: SwitchParameter
Parameter Sets: repositories
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -resourcePools ### -resourcePools
Return all resource pools at the selected site. Return all resource pools at the selected site.
@@ -245,7 +265,7 @@ The identifier of the Zerto Virtual Manager site.
```yaml ```yaml
Type: String Type: String
Parameter Sets: folders, devices, vms, resourcePools, networks, hosts, hostClusters, datastores, datastoreClusters, siteIdentifier Parameter Sets: repositories, folders, devices, vms, resourcePools, networks, hosts, hostClusters, datastores, datastoreClusters, siteIdentifier
Aliases: siteId Aliases: siteId
Required: True Required: True
@@ -271,7 +291,7 @@ Accept wildcard characters: False
``` ```
### CommonParameters ### 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). 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 ## INPUTS
+36 -9
View File
@@ -17,6 +17,11 @@ Returns information when a VPG Settings object is created to create a new or edi
Get-ZertoVpgSetting [<CommonParameters>] Get-ZertoVpgSetting [<CommonParameters>]
``` ```
### ltr
```
Get-ZertoVpgSetting -vpgSettingsIdentifier <String[]> [-ltr] [<CommonParameters>]
```
### volumeIdentifier ### volumeIdentifier
``` ```
Get-ZertoVpgSetting -vpgSettingsIdentifier <String[]> -vmIdentifier <String> -volumeIdentifier <String> Get-ZertoVpgSetting -vpgSettingsIdentifier <String[]> -vmIdentifier <String> -volumeIdentifier <String>
@@ -56,7 +61,7 @@ Get-ZertoVpgSetting -vpgSettingsIdentifier <String[]> [-scripting] [<CommonParam
### recovery ### recovery
``` ```
Get-ZertoVpgSetting -vpgSettingsIdentifier <String[]> [-rcovery] [<CommonParameters>] Get-ZertoVpgSetting -vpgSettingsIdentifier <String[]> [-recovery] [<CommonParameters>]
``` ```
### priority ### priority
@@ -151,10 +156,17 @@ PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -basic
Returns current basic settings for vpgSettingsIdentifier "MySettingsIdentifier" Returns current basic settings for vpgSettingsIdentifier "MySettingsIdentifier"
### Example 6
```powershell
PS C:\> Get-ZertoVpgSetting -vpgSettingsIdentifier "MySettingsIdentifier" -ltr
```
Returns current LTR settings for vpgSettingsIdentifier "MySettingsIdentifier"
## PARAMETERS ## PARAMETERS
### -backup ### -backup
Return backup information for VPG identifier specified Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error.
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
@@ -199,7 +211,7 @@ Accept wildcard characters: False
``` ```
### -dayOfWeek ### -dayOfWeek
Get the day of week a backup is scheduled Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error.
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
@@ -228,6 +240,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -ltr
Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error.
```yaml
Type: SwitchParameter
Parameter Sets: ltr
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -networks ### -networks
Get VPG Network Settings Get VPG Network Settings
@@ -288,13 +315,13 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -rcovery ### -recovery
Get VPG Recovery Settings Get VPG Recovery Settings
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: recovery Parameter Sets: recovery
Aliases: Aliases: rcovery
Required: True Required: True
Position: Named Position: Named
@@ -304,7 +331,7 @@ Accept wildcard characters: False
``` ```
### -retentionPeriod ### -retentionPeriod
Get the retention period for a backup Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error.
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
@@ -319,7 +346,7 @@ Accept wildcard characters: False
``` ```
### -schedulerPeriod ### -schedulerPeriod
Get the backup schedule Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error.
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
@@ -413,7 +440,7 @@ The identifier of the VPG settings object for which information is retrieved.
```yaml ```yaml
Type: String[] Type: String[]
Parameter Sets: volumeIdentifier, volumes, nicIdentifier, nics, vmIdentifier, vms, scripting, recovery, priority, networks, journal, bootGroup, basic, schedulerPeriod, retentionPeriod, dayOfWeek, backup, vpgSettingsIdentifier Parameter Sets: ltr, volumeIdentifier, volumes, nicIdentifier, nics, vmIdentifier, vms, scripting, recovery, priority, networks, journal, bootGroup, basic, schedulerPeriod, retentionPeriod, dayOfWeek, backup, vpgSettingsIdentifier
Aliases: vpgSettingsId, settingsId Aliases: vpgSettingsId, settingsId
Required: True Required: True
@@ -424,7 +451,7 @@ Accept wildcard characters: False
``` ```
### CommonParameters ### 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). 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 ## INPUTS
+39 -3
View File
@@ -1,7 +1,7 @@
--- ---
external help file: ZertoApiWrapper-help.xml external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Get-ZertoZsspSession.md online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Import-ZertoVmNicSetting.md
schema: 2.0.0 schema: 2.0.0
--- ---
@@ -13,13 +13,18 @@ Using a CSV file, will import updated Live and Test network settings for protect
## SYNTAX ## SYNTAX
``` ```
Import-ZertoVmNicSetting [-InputFile] <String> [<CommonParameters>] Import-ZertoVmNicSetting [-InputFile] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
Using a CSV file, will import updated Live and Test network settings for protected virtual machines. This function will read the provided CSV file and only update VMs defined in the file. Using a CSV file, will import updated Live and Test network settings for protected virtual machines. This function will read the provided CSV file and only update VMs defined in the file.
It should be noted, due to current API limitations once a NIC is defined to update to either a Static IP address or use a DHCP address, it is not possible to remove that configuration via the API. Should you require this functionality, you will need to manually update via the GUI to set the option to "No" Each entry in the CSV will be for one VM and a single NIC attached to that VM. Each entry MUST contain the following information: VPG Name, VM Name, Network Adapter Name, Mac Address Update for both Live and Test, and Network Name for both Live and Test. All other information is optional, but will be applied based on the following logic:
* If 'IsDhcp' is set to 'TRUE', the NIC setting will be set to DHCP and Primary DNS, Secondary DNS, and Search Domain settings will be applied along with the mandatory fields.
* If 'IsDhcp' is set to 'FALSE' or not set and there is an IP Address defined, the IP Address, Subnet Mask, Default Gateway, Primary DNS, Secondary DNS, and Search Domain settings will be applied along with the mandatory fields.
* if 'IsDhcp' is set to 'FALSE' or not set and there is NOT an IP Address defined, the current NIC settings will be removed and ONLY the mandatory fields will be applied.
This logic is applied to both the Live and Test settings individually. It is recommended to use the `Export-ZertoVpgNicSetting` to dump all current settings and then modify a copy of the exported file with only the settings you wish to update. Import the copied file and if you need to revert, Import the original.
## EXAMPLES ## EXAMPLES
@@ -47,6 +52,36 @@ Accept pipeline input: False
Accept wildcard characters: 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 ### 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). 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).
@@ -57,4 +92,5 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES ## NOTES
## RELATED LINKS ## RELATED LINKS
[Zerto Virtual Manager REST API VpgSettings 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.110.html%23) [Zerto Virtual Manager REST API VpgSettings 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.110.html%23)
+62 -4
View File
@@ -12,12 +12,26 @@ Install Zerto VRA to a single host in the site with either a Static IP address,
## SYNTAX ## SYNTAX
### DhcpWithRoot
```
Install-ZertoVra -hostName <String> -datastoreName <String> -networkName <String> [-memoryInGB <Int32>]
[-groupName <String>] [-Dhcp] [-UseRootCredential] -HostRootPassword <SecureString> [-WhatIf] [-Confirm]
[<CommonParameters>]
```
### Dhcp ### Dhcp
``` ```
Install-ZertoVra -hostName <String> -datastoreName <String> -networkName <String> [-memoryInGB <Int32>] Install-ZertoVra -hostName <String> -datastoreName <String> -networkName <String> [-memoryInGB <Int32>]
[-groupName <String>] [-Dhcp] [-WhatIf] [-Confirm] [<CommonParameters>] [-groupName <String>] [-Dhcp] [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
### StaticIpWithRoot
```
Install-ZertoVra -hostName <String> -datastoreName <String> -networkName <String> [-memoryInGB <Int32>]
[-groupName <String>] -vraIpAddress <String> -defaultGateway <String> -subnetMask <String>
[-UseRootCredential] -HostRootPassword <SecureString> [-WhatIf] [-Confirm] [<CommonParameters>]
```
### StaticIp ### StaticIp
``` ```
Install-ZertoVra -hostName <String> -datastoreName <String> -networkName <String> [-memoryInGB <Int32>] Install-ZertoVra -hostName <String> -datastoreName <String> -networkName <String> [-memoryInGB <Int32>]
@@ -44,6 +58,20 @@ PS C:\> Install-ZertoVra -hostName "Host01" -datastoreName "Datastore01" -networ
Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning a DHCP address. Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning a DHCP address.
### Example 3
```powershell
PS C:\> Install-ZertoVra -hostName "Host01" -datastoreName "Datastore01" -networkName "VM Network" -vraIpAddress "192.168.1.50" -defaultGateway "192.168.1.254" -subnetMask "255.255.255.0" -UseRootCredential -HostRootPassword $RootPasswordAsSecureString
```
Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning an IP address if "192.168.1.50", subnetmask of "255.255.255.0" and default gateway of "192.168.1.254" using the Root Credential install method.
### Example 4
```powershell
PS C:\> Install-ZertoVra -hostName "Host01" -datastoreName "Datastore01" -networkName "VM Network" -dhcp -UseRootCredential -HostRootPassword $RootPasswordAsSecureString
```
Installs a VRA on the Host "Host01" using datastore "Datastore01" on network "VM Network" assigning a DHCP address using the Root Credential install method.
## PARAMETERS ## PARAMETERS
### -datastoreName ### -datastoreName
@@ -66,7 +94,7 @@ Default gateway to assign to the VRA
```yaml ```yaml
Type: String Type: String
Parameter Sets: StaticIp Parameter Sets: StaticIpWithRoot, StaticIp
Aliases: Aliases:
Required: True Required: True
@@ -81,7 +109,7 @@ Assign a DHCP address to the VRA.
```yaml ```yaml
Type: SwitchParameter Type: SwitchParameter
Parameter Sets: Dhcp Parameter Sets: DhcpWithRoot, Dhcp
Aliases: Aliases:
Required: True Required: True
@@ -122,6 +150,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -HostRootPassword
The password for the root user of the ESXi host where the VRA is to be installed.
```yaml
Type: SecureString
Parameter Sets: DhcpWithRoot, StaticIpWithRoot
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -memoryInGB ### -memoryInGB
Initial amount of memory to assign to the VRA in GB. Initial amount of memory to assign to the VRA in GB.
Default is 3, Minimum is 1, Maximum is 16 Default is 3, Minimum is 1, Maximum is 16
@@ -158,7 +201,22 @@ Subnetmask to be assigned to the VRA
```yaml ```yaml
Type: String Type: String
Parameter Sets: StaticIp Parameter Sets: StaticIpWithRoot, StaticIp
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -UseRootCredential
Use this switch to install the VRA using the root password install method.
```yaml
Type: SwitchParameter
Parameter Sets: DhcpWithRoot, StaticIpWithRoot
Aliases: Aliases:
Required: True Required: True
@@ -173,7 +231,7 @@ Static IP address to assign to the VRA.
```yaml ```yaml
Type: String Type: String
Parameter Sets: StaticIp Parameter Sets: StaticIpWithRoot, StaticIp
Aliases: Aliases:
Required: True Required: True
+100
View File
@@ -0,0 +1,100 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZARestRequest.md
schema: 2.0.0
---
# Invoke-ZARestRequest
## SYNOPSIS
Function used to submit a REST request to the Zerto Analytics Portal. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function.
## SYNTAX
```
Invoke-ZARestRequest [-uri] <String> [[-method] <String>] [[-body] <String>] [<CommonParameters>]
```
## DESCRIPTION
Function used to submit a REST request to the Zerto Analytics Portal. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function. To function properly, you will have to have completed a connection to a Zerto Virtual Manager with the `Connect-ZertoAnalytics` function.
## EXAMPLES
### Example 1
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method GET
```
Submits a GET request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint'. Check the API documentation for the endpoint to ensure the URI is formatted correctly. Typically a GET request does not require a BODY parameter.
### Example 1
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method POST -Body $Body
```
Submits a PUT request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is an object that can be formatted into JSON.
## PARAMETERS
### -body
Body to be submitted to the REST API endpoint.
This needs to be submitted in JSON format
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -method
API method to be used.
GET, PUT, POST, or DELETE.
Refer to documentation for the API endpoint to ensure the correct method is being used.
If unspecified, defaults to GET
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: GET
Accept pipeline input: False
Accept wildcard characters: False
```
### -uri
Parameter help description
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Analytics API Endpoint Documentation](https://docs.api.zerto.com/)
+148
View File
@@ -0,0 +1,148 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoEvacuateVra.md
schema: 2.0.0
---
# Invoke-ZertoEvacuateVra
## SYNOPSIS
This operation will move all VMs currently replicating to the selected host or VRA to different hosts based on internal Zerto algorithms.
## SYNTAX
### VraIdentifier (Default)
```
Invoke-ZertoEvacuateVra -VraIdentifier <String> [-WhatIf] [-Confirm] [<CommonParameters>]
```
### HostName
```
Invoke-ZertoEvacuateVra -HostName <String> [-WhatIf] [-Confirm] [<CommonParameters>]
```
### VraName
```
Invoke-ZertoEvacuateVra -VraName <String> [-WhatIf] [-Confirm] [<CommonParameters>]
```
## DESCRIPTION
This operation will move all VMs currently replicating to the selected host or VRA to different hosts based on internal Zerto algorithms.
This will return a Zerto Task Identifier so the task progress can be tracked.
## EXAMPLES
### Example 1
```powershell
PS C:\> Invoke-ZertoEvacuateVra -HostName 'host01'
```
Will move all VMs currently replicating to the selected host to different hosts.
### Example 2
```powershell
PS C:\> Invoke-ZertoEvacuateVra -VraName 'Z-VRA-host01'
```
Will move all VMs currently replicating to the selected VRA to different VRAs.
### Example 3
```powershell
PS C:\> Invoke-ZertoEvacuateVra -VraIdentifier '1234-1234-4312-9856'
```
Will move all VMs currently replicating to the selected VRA to different VRAs.
## PARAMETERS
### -HostName
HostName Option
```yaml
Type: String
Parameter Sets: HostName
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -VraIdentifier
VRAIdentifier Option
```yaml
Type: String
Parameter Sets: VraIdentifier
Aliases: VraId, Identifier
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
```
### -VraName
VRA Option
```yaml
Type: String
Parameter Sets: VraName
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto REST API Evacuate VRA 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.129.html%23)
+154
View File
@@ -0,0 +1,154 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Invoke-ZertoRestRequest.md
schema: 2.0.0
---
# Invoke-ZertoRestRequest
## SYNOPSIS
Function used to submit a REST request to the Zerto Virtual Manager. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function.
## SYNTAX
```
Invoke-ZertoRestRequest [[-method] <String>] [-uri] <String> [[-body] <String>] [[-credential] <PSCredential>]
[-returnHeaders] [<CommonParameters>]
```
## DESCRIPTION
Function used to submit a REST request to the Zerto Virtual Manager. Should be used when attempting to submit a request inside a ZertoApiWrapper function or if attempting to perform an operation not currently covered in a ZertoApiWrapper function. To function properly, you will have to have completed a connection to a Zerto Virtual Manager with the `Connect-ZertoServer` function.
## EXAMPLES
### Example 1
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method POST -Body $Body
```
Submits a POST request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is a string properly formatted for JSON
### Example 2
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method POST -Body ($Body | ConvertTo-Json)
```
Submits a POST request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is an object that can be formatted into JSON.
### Example 3
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method PUT -Body $Body
```
Submits a PUT request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint' with a Body parameter. Check the API documentation for the endpoint to ensure the URI is formatted correctly and the format of the Body variable. The command above assumes that the $Body variable is a string properly formatted for JSON
### Example 4
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method DELETE
```
Submits a DELETE request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint'. Check the API documentation for the endpoint to ensure the URI is formatted correctly. Typically a DELETE request does not require a BODY parameter.
### Example 5
```powershell
PS C:\> Invoke-ZertoRestRequest -uri 'apiEndpoint/subApiEndpoint' -Method GET
```
Submits a GET request to the connected Zerto Virtual Manager api endpoint 'apiEndpoint/subApiEndpoint'. Check the API documentation for the endpoint to ensure the URI is formatted correctly. Typically a GET request does not require a BODY parameter.
## PARAMETERS
### -body
Body to be submitted to the REST API endpoint.
This needs to be submitted in JSON format
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -credential
PSCredential object.
This is ONLY used when authenticating with the ZVM.
No other endpoints require this and generally is not used.
```yaml
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -method
Parameter help description
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: GET
Accept pipeline input: False
Accept wildcard characters: False
```
### -returnHeaders
Use this switch if you would like the request headers returned along with the body.
Useful for troubleshooting to get HTTP error codes.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### -uri
URI endpoint to be utilized.
When submitting the URI, only the endpoint needs to be submitted.
Please review the help documentation for examples.
```yaml
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
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
## OUTPUTS
## NOTES
## RELATED LINKS
[Zerto Virtual Replication API Endpoint Documentation](https://s3.amazonaws.com/zertodownload_docs/Latest/Zerto%20Virtual%20Replication%20Zerto%20Virtual%20Manager%20(ZVM)%20-%20vSphere%20Online%20Help/content/intro/book_in_portal_-_zvr_restful_apis.htm)
+78
View File
@@ -0,0 +1,78 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/New-ZertoPairingToken.md
schema: 2.0.0
---
# New-ZertoPairingToken
## SYNOPSIS
Generates a new pairing token to be used during pairing ZVM to ZVM operations.
## SYNTAX
```
New-ZertoPairingToken [-WhatIf] [-Confirm] [<CommonParameters>]
```
## DESCRIPTION
Generates a new pairing token to be used during pairing ZVM to ZVM operations. This token is valid until used or 48 hours have passed, whichever comes first. This feature is only required when pairing two Zerto sites that are both operating Zerto version 7.5 or greater. To use this feature you will need to generate a pairing token from the destination site. Once that token is generated you will use that token to pair the source site to the destination site either via the GUI or via the `Add-ZertoPeerSite` function.
## EXAMPLES
### Example 1
```powershell
PS C:\> New-ZertoPairingToken
```
Generates an object that will contain the pairing token and expiration date and time.
## PARAMETERS
### -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
[Zerto REST API Peer Sites 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.046.html%23)
+97
View File
@@ -0,0 +1,97 @@
---
external help file: ZertoApiWrapper-help.xml
Module Name: ZertoApiWrapper
online version: https://github.com/ZertoPublic/ZertoApiWrapper/blob/master/docs/Set-ZertoUserCredential.md
schema: 2.0.0
---
# Set-ZertoUserCredential
## SYNOPSIS
Allows the change or update of the credentials used to allow the Zerto Virtual Manager to connect and communicate with the paired Hypervisor.
## SYNTAX
```
Set-ZertoUserCredential [-UserCredential] <PSCredential> [-WhatIf] [-Confirm] [<CommonParameters>]
```
## DESCRIPTION
Allows the change or update of the credentials used to allow the Zerto Virtual Manager to connect and communicate with the paired Hypervisor. A PSCredential object is required and will be used to pass the updated credentials.
## EXAMPLES
### Example 1
```powershell
PS C:\> Set-ZertoUserCredential -UserCredential $UserCredential
```
Will update the user account used to connect the Zerto Virtual Manager to the the paired Hypervisor.
### Example 2
```powershell
PS C:\> Set-ZertoUserCredential -UserCredential $UserCredential -Confirm:$False
```
Will update the user account used to connect the Zerto Virtual Manager to the the paired Hypervisor. CAUTION: By adding the `-Confirm:$False` parameter, this will suppress the confirmation dialog and you will not be prompted if you wish to complete this action.
## PARAMETERS
### -UserCredential
PSCredential Object that contains the username and password for the updated credentials.
```yaml
Type: PSCredential
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
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
## OUTPUTS
## NOTES
## RELATED LINKS
[PSCredential Object Information](https://docs.microsoft.com/en-us/dotnet/api/system.management.automation.pscredential)
+1 -1
View File
@@ -1 +1 @@
1.2.0 1.4.0