From e6ead11891e522f233b6683732edbfdc4dfe197f Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Tue, 5 May 2020 21:59:14 -0400 Subject: [PATCH] Update mandatory parameter declaration --- .../Private/Get-ZertoApiFilter.ps1 | 2 +- ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 | 2 +- .../Public/Checkpoint-ZertoVpg.ps1 | 8 +- .../Public/Connect-ZertoAnalytics.ps1 | 4 +- .../Public/Connect-ZertoServer.ps1 | 4 +- ZertoApiWrapper/Public/Edit-ZertoVra.ps1 | 2 +- ZertoApiWrapper/Public/Export-ZertoVpg.ps1 | 6 +- ZertoApiWrapper/Public/Get-ZAAlert.ps1 | 2 +- ZertoApiWrapper/Public/Get-ZADatastore.ps1 | 10 +-- ZertoApiWrapper/Public/Get-ZATask.ps1 | 2 +- ZertoApiWrapper/Public/Get-ZAVpg.ps1 | 2 +- ZertoApiWrapper/Public/Get-ZertoAlert.ps1 | 8 +- ZertoApiWrapper/Public/Get-ZertoEvent.ps1 | 8 +- ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 | 4 +- .../Public/Get-ZertoProtectedVm.ps1 | 2 +- .../Public/Get-ZertoVirtualizationSite.ps1 | 42 +++++----- ZertoApiWrapper/Public/Get-ZertoVpg.ps1 | 24 +++--- .../Public/Get-ZertoVpgSetting.ps1 | 82 +++++++++---------- ZertoApiWrapper/Public/Import-ZertoVpg.ps1 | 2 +- .../Public/Invoke-ZertoFailover.ps1 | 6 +- .../Public/Invoke-ZertoFailoverCommit.ps1 | 2 +- .../Public/Invoke-ZertoFailoverRollback.ps1 | 2 +- .../Public/Invoke-ZertoForceSync.ps1 | 2 +- ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 | 6 +- .../Public/Invoke-ZertoMoveCommit.ps1 | 4 +- .../Public/Invoke-ZertoMoveRollback.ps1 | 2 +- ZertoApiWrapper/Public/New-ZertoVpg.ps1 | 36 ++++---- .../Public/New-ZertoVpgSettingsIdentifier.ps1 | 4 +- .../Public/Remove-ZertoPeerSite.ps1 | 12 +-- ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 | 6 +- ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 | 2 +- .../Public/Save-ZertoVpgSetting.ps1 | 2 +- ZertoApiWrapper/Public/Set-ZertoAlert.ps1 | 6 +- ZertoApiWrapper/Public/Set-ZertoLicense.ps1 | 6 +- .../Public/Start-ZertoCloneVpg.ps1 | 8 +- .../Public/Start-ZertoFailoverTest.ps1 | 2 +- ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 | 2 +- .../Public/Stop-ZertoFailoverTest.ps1 | 4 +- ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 | 2 +- ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 | 2 +- 40 files changed, 167 insertions(+), 167 deletions(-) diff --git a/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 b/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 index 25b52e9..53fbeed 100644 --- a/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 +++ b/ZertoApiWrapper/Private/Get-ZertoApiFilter.ps1 @@ -3,7 +3,7 @@ function Get-ZertoApiFilter { [Outputtype([String])] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Hashtable that contains filter keys and values" )] [ValidateNotNullOrEmpty()] diff --git a/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 b/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 index 9cbd5db..e4bed27 100644 --- a/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 +++ b/ZertoApiWrapper/Public/Add-ZertoPeerSite.ps1 @@ -3,7 +3,7 @@ function Add-ZertoPeerSite { [cmdletbinding( SupportsShouldProcess = $true )] param( [parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Target Hostname or IP address to pair the localsite to." )] [ValidateScript( { $_ -match [IPAddress]$_ } )] diff --git a/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 index c0dd1a4..65dfbfa 100644 --- a/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Checkpoint-ZertoVpg.ps1 @@ -3,7 +3,7 @@ function Checkpoint-ZertoVpg { [cmdletbinding()] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Name of the VPG to tag.", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true @@ -11,7 +11,7 @@ function Checkpoint-ZertoVpg { [ValidateNotNullOrEmpty()] [string[]]$vpgName, [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Text to tag the checkpoint with." )] [ValidateNotNullOrEmpty()] @@ -27,10 +27,10 @@ function Checkpoint-ZertoVpg { $vpgIdentifier = $(get-zertovpg -name $name).vpgIdentifier if ($vpgIdentifier) { $uri = "{0}/{1}/Checkpoints" -f $baseUri, $vpgIdentifier - $body = @{"checkpointName" = $checkpointName} + $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." + Write-Output "Cannot find VPG named $name. Please check the name and try again." } } } diff --git a/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 index 2c8e95f..8bbd20a 100644 --- a/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 +++ b/ZertoApiWrapper/Public/Connect-ZertoAnalytics.ps1 @@ -3,7 +3,7 @@ function Connect-ZertoAnalytics { [cmdletbinding()] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "PSCredential Object containing username and password authorized for the Zerto Analytics site", Position = 0 )] @@ -17,4 +17,4 @@ function Connect-ZertoAnalytics { $result = Invoke-ZARestRequest -Uri $uri -body $($body | ConvertTo-Json) -Method POST $Script:zaHeaders["Authorization"] = "Bearer $($result.Token)" $Script:zaHeaders -} \ No newline at end of file +} diff --git a/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 b/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 index 177374c..f9f33ac 100644 --- a/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 +++ b/ZertoApiWrapper/Public/Connect-ZertoServer.ps1 @@ -4,7 +4,7 @@ function Connect-ZertoServer { [OutputType([hashtable])] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "IP address or FQDN of your Zerto Management Server" )] [ValidateNotNullOrEmpty()] @@ -18,7 +18,7 @@ function Connect-ZertoServer { [Alias("port")] [string]$zertoPort = "9669", [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Valid credentials to connect to the Zerto Management Server" )] [System.Management.Automation.PSCredential]$credential, diff --git a/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 b/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 index 0b1b9fc..855f0d4 100644 --- a/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 +++ b/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 @@ -3,7 +3,7 @@ function Edit-ZertoVra { [cmdletbinding( SupportsShouldProcess = $true )] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Identifier of the VRA to be updated." )] [ValidateNotNullOrEmpty()] diff --git a/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 index 3f5efb8..2d00a83 100644 --- a/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Export-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Export-ZertoVpg { param( [Parameter( HelpMessage = "Location where to dump the resulting JSON files containing the VPG Settings", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [Alias("outputFolder")] @@ -12,7 +12,7 @@ function Export-ZertoVpg { [parameter( HelpMessage = "Name(s) of the VPG(s) to be exported", ParameterSetName = "namedVpgs", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, @@ -21,7 +21,7 @@ function Export-ZertoVpg { ParameterSetName = "allVpgs", valuefrompipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] [switch]$allVpgs ) diff --git a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 index 1026895..e173b34 100644 --- a/ZertoApiWrapper/Public/Get-ZAAlert.ps1 +++ b/ZertoApiWrapper/Public/Get-ZAAlert.ps1 @@ -17,7 +17,7 @@ function Get-ZAAlert { [Parameter( HelpMessage = "The alert Idnetifier", ParameterSetName = "alertId", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$alertIdentifier diff --git a/ZertoApiWrapper/Public/Get-ZADatastore.ps1 b/ZertoApiWrapper/Public/Get-ZADatastore.ps1 index 14f074a..315e26c 100644 --- a/ZertoApiWrapper/Public/Get-ZADatastore.ps1 +++ b/ZertoApiWrapper/Public/Get-ZADatastore.ps1 @@ -4,15 +4,15 @@ function Get-ZADatastore { param ( [Parameter( HelpMessage = "The site identifier. The site identifier is mandatory. Omit the datastore and datastore cluster identifiers to view site level storage information.", - Mandatory = $true, + Mandatory, ParameterSetName = "AllInfo" )] [Parameter( - Mandatory = $true, + Mandatory, ParameterSetName = "cluster" )] [Parameter( - Mandatory = $true, + Mandatory, ParameterSetName = "datastore" )] [ValidateNotNullOrEmpty()] @@ -20,14 +20,14 @@ function Get-ZADatastore { [Parameter( HelpMessage = "The datastore cluster identifier. Gets a list of datastores in the cluster.", ParameterSetName = "cluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$clusterIdentifier, [Parameter( HelpMessage = "The datastore identifer. Gets the datastore info.", ParameterSetName = "datastore", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$datastoreIdentifier diff --git a/ZertoApiWrapper/Public/Get-ZATask.ps1 b/ZertoApiWrapper/Public/Get-ZATask.ps1 index 2f1bce5..d13ebb3 100644 --- a/ZertoApiWrapper/Public/Get-ZATask.ps1 +++ b/ZertoApiWrapper/Public/Get-ZATask.ps1 @@ -17,7 +17,7 @@ function Get-ZATask { [Parameter( HelpMessage = "The task Idnetifier", ParameterSetName = "taskId", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$taskIdentifier diff --git a/ZertoApiWrapper/Public/Get-ZAVpg.ps1 b/ZertoApiWrapper/Public/Get-ZAVpg.ps1 index a105390..bb50cb8 100644 --- a/ZertoApiWrapper/Public/Get-ZAVpg.ps1 +++ b/ZertoApiWrapper/Public/Get-ZAVpg.ps1 @@ -11,7 +11,7 @@ function Get-ZAVpg { [Parameter( HelpMessage = "The VPG Identifier", ParameterSetName = "vpg", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgIdentifier diff --git a/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 b/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 index abd4571..d9d9181 100644 --- a/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoAlert.ps1 @@ -4,7 +4,7 @@ function Get-ZertoAlert { param( [Parameter( ParameterSetName = "alertId", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true , HelpMessage = "AlertId or array of AlertIds to be queried" @@ -13,19 +13,19 @@ function Get-ZertoAlert { [string[]]$alertId, [Parameter( ParameterSetName = "entities", - Mandatory = $true, + Mandatory, HelpMessage = "Switch to return the entities information from the API" )] [switch]$entities, [Parameter( ParameterSetName = "helpIdentifiers", - Mandatory = $true, + Mandatory, HelpMessage = "Switch to get the Help Identifiers information from the API" )] [switch]$helpIdentifiers, [Parameter( ParameterSetName = "levels", - Mandatory = $true, + Mandatory, HelpMessage = "Switch to return Alert Levels information from the API" )] [switch]$levels, diff --git a/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 b/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 index 1dbec44..8094ac2 100644 --- a/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoEvent.ps1 @@ -86,7 +86,7 @@ function Get-ZertoEvent { [string]$alertIdentifier, [Parameter( ParameterSetName = "eventId", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = "The identifier or identifiers of the event for which information is returned." @@ -95,19 +95,19 @@ function Get-ZertoEvent { [string[]]$eventId, [Parameter( ParameterSetName = "categories", - Mandatory = $true, + Mandatory, HelpMessage = "Returns possible Event Categories." )] [switch]$categories, [Parameter( ParameterSetName = "entities", - Mandatory = $true, + Mandatory, HelpMessage = "Returns possible entity types." )] [switch]$entities, [Parameter( ParameterSetName = "types", - Mandatory = $true, + Mandatory, HelpMessage = "Returns possible event types.")] [switch]$types ) diff --git a/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 b/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 index cb86c53..d5c42e3 100644 --- a/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoPeerSite.ps1 @@ -5,12 +5,12 @@ function Get-ZertoPeerSite { [Parameter( ParameterSetName = "pairingStatuses", HelpMessage = "Switch to return possible paiting statuses.", - Mandatory = $true + Mandatory )] [switch]$pairingStatuses, [Parameter( ParameterSetName = "siteIdentifier", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = "The identifier(s) of the peer site(s) for which information is to be returned." diff --git a/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 b/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 index 36dc2aa..e559926 100644 --- a/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoProtectedVm.ps1 @@ -4,7 +4,7 @@ function Get-ZertoProtectedVm { param ( [Parameter( ParameterSetName = "vmIdentifier", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, HelpMessage = "vmIdentifier(s) for which to return information" diff --git a/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 b/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 index 2dd1b23..ddaaf20 100644 --- a/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoVirtualizationSite.ps1 @@ -4,57 +4,57 @@ function Get-ZertoVirtualizationSite { param( [Parameter( ParameterSetName = "siteIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "datastoreClusters", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "datastores", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "hostClusters", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "hosts", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "networks", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "resourcePools", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "vms", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "devices", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "folders", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [Parameter( ParameterSetName = "repositories", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [ValidateNotNullOrEmpty()] @@ -62,19 +62,19 @@ function Get-ZertoVirtualizationSite { [string]$siteIdentifier, [Parameter( ParameterSetName = "datastoreClusters", - Mandatory = $true, + Mandatory, HelpMessage = "When selected, will return all datastore clusters at the specified site." )] [switch]$datastoreClusters, [Parameter( ParameterSetName = "datastores", - Mandatory = $true, + Mandatory, HelpMessage = "When selected, will return all datastores at the specified site." )] [switch]$datastores, [Parameter( ParameterSetName = "devices", - Mandatory = $true, + Mandatory, HelpMessage = "When selected, will return all devices at the specified site." )] [switch]$devices, @@ -93,43 +93,43 @@ function Get-ZertoVirtualizationSite { [string]$hostIdentifier, [Parameter( ParameterSetName = "folders", - Mandatory = $true, + Mandatory, HelpMessage = "Return all folders at the selected site." )] [switch]$folders, [Parameter( ParameterSetName = "hostClusters", - Mandatory = $true, + Mandatory, HelpMessage = "Return all host clusters at the selected site." )] [switch]$hostClusters, [Parameter( ParameterSetName = "hosts", - Mandatory = $true, + Mandatory, HelpMessage = "Return all hosts at the selected site. If a host identifier is provided, return only that host." )] [switch]$hosts, [Parameter( ParameterSetName = "networks", - Mandatory = $true, + Mandatory, HelpMessage = "Return all networks at the selected site." )] [switch]$networks, [Parameter( ParameterSetName = "resourcePools", - Mandatory = $true, + Mandatory, HelpMessage = "Return all resource pools at the selected site." )] [switch]$resourcePools, [Parameter( ParameterSetName = "vms", - Mandatory = $true, + Mandatory, HelpMessage = "Return all VMs at the selected site." )] [switch]$vms, [Parameter( ParameterSetName = "repositories", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the Zerto Virtual Manager site." )] [switch]$repositories diff --git a/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 index 6990526..c26a968 100644 --- a/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoVpg.ps1 @@ -4,17 +4,17 @@ function Get-ZertoVpg { param( [Parameter( ParameterSetName = "protectionGroupIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier(s) of the Virtual Protection Group to return" )] [Parameter( ParameterSetName = "checkpoints", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier(s) of the Virtual Protection Group to return" )] [Parameter( ParameterSetName = "stats", - Mandatory = $true, + Mandatory, HelpMessage = "The identifier(s) of the Virtual Protection Group to return" )] [ValidateNotNullOrEmpty()] @@ -22,7 +22,7 @@ function Get-ZertoVpg { [string[]]$protectionGroupIdentifier, [Parameter( ParameterSetName = "checkpoints", - Mandatory = $true, + Mandatory, HelpMessage = "Return checkpoints for the selected Virtual Protection Group." )] [switch]$checkpoints, @@ -39,49 +39,49 @@ function Get-ZertoVpg { [ValidateNotNullOrEmpty()] [string]$endDate, [Parameter( - ParameterSetName = "stats", Mandatory = $true, + ParameterSetName = "stats", Mandatory, HelpMessage = "Return earliest and latest checkpoints for the selected Virtual Protection Group" )] [switch]$checkpointsStats, [Parameter( ParameterSetName = "entityTypes", - Mandatory = $true, + Mandatory, HelpMessage = "Return Valid VPG entityTypes" )] [switch]$entityTypes, [Parameter( ParameterSetName = "failoverCommitPolicies", - Mandatory = $true, + Mandatory, HelpMessage = "Valid Failover Commit Policies" )] [switch]$failoverCommitPolicies, [Parameter( ParameterSetName = "failoverShutdownPolicies", - Mandatory = $true, + Mandatory, HelpMessage = "Valid Failover Shutdown Policies" )] [switch]$failoverShutdownPolicies, [Parameter( ParameterSetName = "priorities", - Mandatory = $true, + Mandatory, HelpMessage = "Valid VPG priorities" )] [switch]$priorities, [Parameter( ParameterSetName = "retentionPolicies", - Mandatory = $true, + Mandatory, HelpMessage = "Valid retention policies" )] [switch]$retentionPolicies, [Parameter( ParameterSetName = "statuses", - Mandatory = $true, + Mandatory, HelpMessage = "Valid VPG statuses" )] [switch]$statuses, [Parameter( ParameterSetName = "subStatuses", - Mandatory = $true, + Mandatory, HelpMessage = "Valid VPG sub statuses" )] [switch]$subStatuses, diff --git a/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 b/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 index 533430b..13164a1 100644 --- a/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 +++ b/ZertoApiWrapper/Public/Get-ZertoVpgSetting.ps1 @@ -10,7 +10,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -18,7 +18,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [Parameter( @@ -26,7 +26,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -34,7 +34,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -42,7 +42,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -50,7 +50,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -58,7 +58,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -66,7 +66,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -74,7 +74,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -82,7 +82,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -90,7 +90,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -98,7 +98,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -106,7 +106,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -114,7 +114,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -122,7 +122,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -130,7 +130,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -138,7 +138,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -146,7 +146,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [Parameter( @@ -154,7 +154,7 @@ function Get-ZertoVpgSetting { ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, ValueFromRemainingArguments = $true, - Mandatory = $true, + Mandatory, HelpMessage = "The identifier of the VPG settings object for which information is retrieved." )] [ValidateNotNullOrEmpty()] @@ -162,100 +162,100 @@ function Get-ZertoVpgSetting { [string[]]$vpgSettingsIdentifier, [Parameter( ParameterSetName = "backup", - Mandatory = $true, + Mandatory, HelpMessage = "Return backup information for VPG identifier specified. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$backup, [Parameter( ParameterSetName = "dayOfWeek", - Mandatory = $true, + Mandatory, HelpMessage = "Get the day of week a backup is scheduled. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$dayOfWeek, [Parameter( ParameterSetName = "retentionPeriod", - Mandatory = $true, + Mandatory, HelpMessage = "Get the retention period for a backup. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$retentionPeriod, [Parameter( ParameterSetName = "schedulerPeriod", - Mandatory = $true, + Mandatory, HelpMessage = "Get the backup schedule. Please note, this parameter is ONLY available in Zerto version 7.5 and earlier. Attempting to run this switch against a Zerto Virtual Manager version 8.0 or higher result in an error." )] [switch]$schedulerPeriod, [Parameter( ParameterSetName = "basic", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Basic Settings" )] [switch]$basic, [Parameter( ParameterSetName = "bootGroup", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Boot Settings" )] [switch]$bootgroup, [Parameter( ParameterSetName = "journal", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Journal Settings" )] [switch]$journal, [Parameter( ParameterSetName = "networks", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Network Settings" )] [switch]$networks, [Parameter( ParameterSetName = "priority", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Priority Settings" )] [switch]$priority, [Parameter( ParameterSetName = "recovery", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Recovery Settings" )] [Alias("rcovery")] [switch]$recovery, [Parameter( ParameterSetName = "scripting", - Mandatory = $true, + Mandatory, HelpMessage = "Get VPG Recovery Settings" )] [switch]$scripting, [Parameter( ParameterSetName = "vms", - Mandatory = $true, + Mandatory, HelpMessage = "Get all settings for all VMs in a VPG." )] [switch]$vms, [Parameter( ParameterSetName = "vmIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "Get all settings for selected VM" )] [Parameter( ParameterSetName = "nics", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [Parameter( ParameterSetName = "volumes", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [Parameter( ParameterSetName = "nicIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [Parameter( ParameterSetName = "volumeIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "VM Identifier" )] [ValidateNotNullOrEmpty()] @@ -263,13 +263,13 @@ function Get-ZertoVpgSetting { [string]$vmIdentifier, [Parameter( ParameterSetName = "nics", - Mandatory = $true, + Mandatory, HelpMessage = "Return NIC information for all NICs of the specified VM" )] [switch]$nics, [Parameter( ParameterSetName = "nicIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "Return NIC information for specified NIC of the specified VM" )] [ValidateNotNullOrEmpty()] @@ -277,13 +277,13 @@ function Get-ZertoVpgSetting { [string]$nicIdentifier, [Parameter( ParameterSetName = "volumes", - Mandatory = $true, + Mandatory, HelpMessage = "Return Volume information for all volumes of the specified VM" )] [switch]$volumes, [Parameter( ParameterSetName = "volumeIdentifier", - Mandatory = $true, + Mandatory, HelpMessage = "Return volume information for the specified volume of the specified VM" )] [ValidateNotNullOrEmpty()] @@ -291,7 +291,7 @@ function Get-ZertoVpgSetting { [string]$volumeIdentifier, [Parameter( ParameterSetName = "ltr", - Mandatory = $true, + Mandatory, HelpMessage = "Return LTR information for the specified VPG. Please note, this parameter is ONLY available in Zerto version 8.0 and later. Attempting to run this switch against a Zerto Virtual Manager version 7.5 or lower will result in an error." )] [switch]$ltr diff --git a/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 index 48a72cc..30675b9 100644 --- a/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Import-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Import-ZertoVpg { param( [Parameter( HelpMessage = "VPG settings JSON file(s) to import.", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] diff --git a/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 index 5eb5500..013a50c 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoFailover.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoFailover { param( #TODO - Refactor? [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Name of the VPG to Failover" )] [ValidateNotNullOrEmpty()] @@ -54,7 +54,7 @@ function Invoke-ZertoFailover { Write-Error "VPG: $vpgName Not Found. Please check the name and try again!" -ErrorAction Stop } $baseUri = "vpgs/{0}/failover" -f $vpgId - $body = @{} + $body = @{ } # Setup Required Defaults $body['commitpolicy'] = $commitPolicy $body['TimeToWaitBeforeShutdownInSec'] = $timeToWaitBeforeShutdownInSec @@ -76,7 +76,7 @@ function Invoke-ZertoFailover { $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName [System.Collections.ArrayList]$vmIdentifiers = @() 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) { Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { diff --git a/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 index cbd5250..cf91f81 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoFailoverCommit.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoFailoverCommit { param( [Parameter( HelpMessage = "Name(s) of the VPG(s) to commit.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, diff --git a/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 index fc6b92f..4391d65 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoFailoverRollback.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoFailoverRollback { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to roll back from failing over", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 index 81ee866..8e5c351 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoForceSync.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoForceSync { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to force sync", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 index 2f82592..476f7d3 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoMove.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoMove { param( [Parameter( HelpMessage = "Name(s) of the VPG(s) you want to move.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, @@ -29,13 +29,13 @@ function Invoke-ZertoMove { [Parameter( ParameterSetName = "disableReverseProtection", HelpMessage = "Do not enable reverse protection. The VPG definition is kept with the status Needs Configuration and the reverse settings in the VPG definition are not set.", - Mandatory = $true + Mandatory )] [switch]$disableReverseProtection, [Parameter( ParameterSetName = "keepSourceVms", HelpMessage = "Prevent the protected virtual machines from being deleted in the protected site. Using this setting disables reverse protection.", - Mandatory = $true + Mandatory )] [switch]$keepSourceVms, [Parameter( diff --git a/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 index f524af1..39327c8 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoMoveCommit.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoMoveCommit { param( [Parameter( HelpMessage = "Name(s) of the VPG(s) to commit.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, @@ -20,7 +20,7 @@ function Invoke-ZertoMoveCommit { begin { $baseUri = "vpgs" - $body = @{} + $body = @{ } if ($reverseProtection) { $body["ReverseProtection"] = $true } elseif ($keepSourceVms) { diff --git a/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 b/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 index b1d7e24..36728dd 100644 --- a/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 +++ b/ZertoApiWrapper/Public/Invoke-ZertoMoveRollback.ps1 @@ -4,7 +4,7 @@ function Invoke-ZertoMoveRollback { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to roll back from failing over", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/New-ZertoVpg.ps1 b/ZertoApiWrapper/Public/New-ZertoVpg.ps1 index bdbc18b..4ae6f60 100644 --- a/ZertoApiWrapper/Public/New-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/New-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function New-ZertoVpg { param( [Parameter( HelpMessage = "Name of the VPG", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName, @@ -20,89 +20,89 @@ function New-ZertoVpg { [int]$journalHistoryInHours = 24, [Parameter( HelpMessage = "Name(s) of the VM(s) to be protected.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$protectedVm, [Parameter( HelpMessage = "Name of the site where the VM(s) will be recovered", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoverySite, [Parameter( HelpMessage = "Name of the cluster where the VM(s) will be recovered.", ParameterSetName = "recoveryClusterDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the cluster where the VM(s) will be recovered.", ParameterSetName = "recoveryClusterDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryCluster, [Parameter( HelpMessage = "Name of the host where the VM(s) will be recovered.", ParameterSetName = "recoveryHostDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the host where the VM(s) will be recovered.", ParameterSetName = "recoveryHostDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryHost, [Parameter( HelpMessage = "Name of the resource pool where the VM(s) will be recovered.", ParameterSetName = "recoveryResourcePoolDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the resource pool where the VM(s) will be recovered.", ParameterSetName = "recoveryResourcePoolDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryResourcePool, [Parameter( HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryClusterDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryHostDatastore", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryResourcePoolDatastore", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$datastore, [Parameter( HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryClusterDatastoreCluster", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryHostDatastoreCluster", - Mandatory = $true + Mandatory )] [Parameter( HelpMessage = "Name of the datastore cluster where the VM(s), Volume(s), and Journal(s) will reside.", ParameterSetName = "recoveryResourcePoolDatastoreCluster", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$datastoreCluster, [Parameter( HelpMessage = "Name of folder at recovery location where the recovered virtual machine(s) will be created.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$recoveryFolder, @@ -132,13 +132,13 @@ function New-ZertoVpg { [String]$zorg, [Parameter( HelpMessage = "Name of the network to use during a Failover Live \ Move VPG operation.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [String]$recoveryNetwork, [Parameter( HelpMessage = "Name of the network to use during a Failover Test operation", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$testNetwork, diff --git a/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 b/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 index 06150d2..53efea7 100644 --- a/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 +++ b/ZertoApiWrapper/Public/New-ZertoVpgSettingsIdentifier.ps1 @@ -5,7 +5,7 @@ function New-ZertoVpgSettingsIdentifier { [Parameter( HelpMessage = "Identifier of the VPG to create a VPG settings identifier. If a vpgIdentifier is not provided, a new VPG settings object is created without any configured settings. This would be used for creating a new VPG from scratch.", ParameterSetName = "existingVpg", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] @@ -15,7 +15,7 @@ function New-ZertoVpgSettingsIdentifier { [Parameter( HelpMessage = "Use this switch when creating a vpgSettingsIdentifier for a new VPG", ParameterSetName = "newVpg", - Mandatory = $true + Mandatory )] [switch]$newVpg ) diff --git a/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 b/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 index 0d818e9..64e4289 100644 --- a/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 +++ b/ZertoApiWrapper/Public/Remove-ZertoPeerSite.ps1 @@ -10,7 +10,7 @@ function Remove-ZertoPeerSite { ParameterSetName = "siteIdentifier", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [Alias("siteId")] @@ -20,7 +20,7 @@ function Remove-ZertoPeerSite { ParameterSetName = "peerSiteName", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$peerSiteName, @@ -29,9 +29,9 @@ function Remove-ZertoPeerSite { ParameterSetName = "hostName", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true + Mandatory )] - [ValidateScript( {$_ -match [IPAddress]$_ })] + [ValidateScript( { $_ -match [IPAddress]$_ })] [string[]]$hostName, [Parameter( HelpMessage = "Specify this switch to Keep the target replica disks for any VPGs replicating between the sites as the VPGs will be deleted by unpairing the sites. If this switch is not used, the target replica disks will be deleted" @@ -41,7 +41,7 @@ function Remove-ZertoPeerSite { begin { $baseUri = "peersites" - $body = @{} + $body = @{ } if ( $keepTargetDisks ) { $body['IsKeepTargetDisks'] = $true } else { @@ -78,4 +78,4 @@ function Remove-ZertoPeerSite { end { # Nothing to do } -} \ No newline at end of file +} diff --git a/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 index 5e453fb..e389705 100644 --- a/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Remove-ZertoVpg.ps1 @@ -3,7 +3,7 @@ function Remove-ZertoVpg { [cmdletbinding( SupportsShouldProcess = $true, DefaultParameterSetName = "vpgIdentifier" )] param( [Parameter( - Mandatory = $true, + Mandatory, ParameterSetName = "vpgName", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, @@ -12,7 +12,7 @@ function Remove-ZertoVpg { [ValidateNotNullOrEmpty()] [string[]]$vpgName, [Parameter( - Mandatory = $true, + Mandatory, ParameterSetName = "vpgIdentifier", ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, @@ -33,7 +33,7 @@ function Remove-ZertoVpg { begin { $baseUri = "vpgs" - $body = @{} + $body = @{ } if ($keepRecoveryVolumes) { $body['KeepRecoveryVolumes'] = $True } else { diff --git a/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 index 24e1c8f..a1b10d7 100644 --- a/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Resume-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Resume-ZertoVpg { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to resume replication", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 b/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 index 6f06b40..055febc 100644 --- a/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 +++ b/ZertoApiWrapper/Public/Save-ZertoVpgSetting.ps1 @@ -6,7 +6,7 @@ function Save-ZertoVpgSetting { param( [Parameter( HelpMessage = "VpgSettings Identifier to save", - Mandatory = $true, + Mandatory, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true )] diff --git a/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 b/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 index 1969177..725dd5b 100644 --- a/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 +++ b/ZertoApiWrapper/Public/Set-ZertoAlert.ps1 @@ -5,7 +5,7 @@ function Set-ZertoAlert { [Parameter( ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true, - Mandatory = $true, + Mandatory, HelpMessage = "Alert identifier(s) to be dismissed or undismissed." )] [ValidateNotNullOrEmpty()] @@ -13,13 +13,13 @@ function Set-ZertoAlert { [string[]]$alertId, [Parameter( ParameterSetName = "dismiss", - Mandatory = $true, + Mandatory, HelpMessage = "Will dismiss the selected alert." )] [switch]$dismiss, [Parameter( ParameterSetName = "undismiss", - Mandatory = $true, + Mandatory, HelpMessage = "Will undismiss the selected alert." )] [switch]$undismiss diff --git a/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 b/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 index 6ce7e32..aa95042 100644 --- a/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 +++ b/ZertoApiWrapper/Public/Set-ZertoLicense.ps1 @@ -3,7 +3,7 @@ function Set-ZertoLicense { [cmdletbinding( SupportsShouldProcess = $true )] param ( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "License Key to apply to the Zerto Virtual Manager" )] [ValidateNotNullOrEmpty()] @@ -12,7 +12,7 @@ function Set-ZertoLicense { begin { $baseUri = "license" - $body = @{"LicenseKey" = $licenseKey} + $body = @{"LicenseKey" = $licenseKey } } process { @@ -24,4 +24,4 @@ function Set-ZertoLicense { end { # Nothing to do } -} \ No newline at end of file +} diff --git a/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 b/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 index 1678c8b..ae95a22 100644 --- a/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 +++ b/ZertoApiWrapper/Public/Start-ZertoCloneVpg.ps1 @@ -4,7 +4,7 @@ function Start-ZertoCloneVpg { param( [Parameter( HelpMessage = "Name of the VPG you wish to clone.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName, @@ -36,7 +36,7 @@ function Start-ZertoCloneVpg { if ( $PSBoundParameters.ContainsKey('datastoreName') ) { $recoverysiteIdentifier = $vpgInfo.recoverysite.identifier $recoverySiteDatastores = Get-ZertoVirtualizationSite -siteIdentifier $recoverysiteIdentifier -datastores - $datastoreIdentifier = $($recoverySiteDatastores | Where-Object {$_.datastoreName -like $datastoreName}).DatastoreIdentifier + $datastoreIdentifier = $($recoverySiteDatastores | Where-Object { $_.datastoreName -like $datastoreName }).DatastoreIdentifier if ( -not $datastoreIdentifier ) { Write-Error "Datastore: $datastoreName is not a valid datastore. Please check the name and try again." -ErrorAction Stop } @@ -45,7 +45,7 @@ function Start-ZertoCloneVpg { $vpgVmInformation = Get-ZertoProtectedVm -vpgName $vpgName [System.Collections.ArrayList]$vmIdentifiers = @() 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) { Write-Error "VM: $name NOT found in VPG $vpgName. Check the name and try again." -ErrorAction Stop } elseif ($vmIdentifiers.Contains($selectedVm.vmIdentifier.toString())) { @@ -63,7 +63,7 @@ function Start-ZertoCloneVpg { process { $uri = "{0}/{1}/CloneStart" -f $baseUri, $vpgIdentifier - $body = [ordered]@{} + $body = [ordered]@{ } if ( $PSBoundParameters.ContainsKey('checkpointIdentifier') ) { $body['checkpointId'] = $checkpointIdentifier } diff --git a/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 b/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 index c889e0c..9c3512d 100644 --- a/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 +++ b/ZertoApiWrapper/Public/Start-ZertoFailoverTest.ps1 @@ -4,7 +4,7 @@ function Start-ZertoFailoverTest { param( [Parameter( HelpMessage = "Name of VPG to failover test", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName, diff --git a/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 b/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 index 6e78ade..f0d4bb5 100644 --- a/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 +++ b/ZertoApiWrapper/Public/Stop-ZertoCloneVpg.ps1 @@ -4,7 +4,7 @@ function Stop-ZertoCloneVpg { param( [Parameter( HelpMessage = "Name of the VPG to stop cloning", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string]$vpgName diff --git a/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 b/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 index babb190..9b5774e 100644 --- a/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 +++ b/ZertoApiWrapper/Public/Stop-ZertoFailoverTest.ps1 @@ -4,7 +4,7 @@ function Stop-ZertoFailoverTest { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to stop testing.", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName, @@ -21,7 +21,7 @@ function Stop-ZertoFailoverTest { begin { $baseUri = "vpgs" - $body = @{"FailoverTestSuccess" = $failoverTestSuccess; "FailoverTestSummary" = $failoverTestSummary} + $body = @{"FailoverTestSuccess" = $failoverTestSuccess; "FailoverTestSummary" = $failoverTestSummary } } process { diff --git a/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 b/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 index c590859..09278e2 100644 --- a/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 +++ b/ZertoApiWrapper/Public/Suspend-ZertoVpg.ps1 @@ -4,7 +4,7 @@ function Suspend-ZertoVpg { param( [Parameter( HelpMessage = "Name(s) of VPG(s) to pause replication", - Mandatory = $true + Mandatory )] [ValidateNotNullOrEmpty()] [string[]]$vpgName diff --git a/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 b/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 index b62f332..bd5c701 100644 --- a/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 +++ b/ZertoApiWrapper/Public/Uninstall-ZertoVra.ps1 @@ -3,7 +3,7 @@ function Uninstall-ZertoVra { [cmdletbinding()] param( [Parameter( - Mandatory = $true, + Mandatory, HelpMessage = "Host Name attached to the VRA to be removed." )] [ValidateNotNullOrEmpty()]