From 22d1151c66f503d4b7447d3d89b59c0b9ffe1166 Mon Sep 17 00:00:00 2001 From: Wes Carroll Date: Sat, 30 Mar 2019 23:20:35 -0400 Subject: [PATCH] Provide minimal information when updating group-name --- ZertoApiWrapper/Public/Edit-ZertoVra.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 b/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 index 638f37c..83a2672 100644 --- a/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 +++ b/ZertoApiWrapper/Public/Edit-ZertoVra.ps1 @@ -6,11 +6,13 @@ function Edit-ZertoVra { Mandatory = $true, HelpMessage = "Identifier of the VRA to be updated." )] + [ValidateNotNullOrEmpty()] [Alias("vraId")] [string]$vraIdentifier, [Parameter( HelpMessage = "Bandwidth group to assign to the VRA. If unspecified will not modify current assignment" )] + [ValidateNotNullOrEmpty()] [string]$groupName, [Parameter( ParameterSetName = "StaticIp", @@ -49,7 +51,7 @@ function Edit-ZertoVra { $vraUpdate['GroupName'] = $vra.VraGroup } # If ParameterSetName StaticIp is used, update the parameters submitted - if ( $PSCmdlet.ParameterSetName -eq 'StaticIp' ) { + if ( $PSCmdlet.ParameterSetName -eq 'StaticIp' -or $vra.VraNetworkDataApi.VraIPConfigurationTypeApi -eq "Static" ) { if ( $PSBoundParameters.ContainsKey('defaultGateway') ) { $vraNetwork['DefaultGateway'] = $defaultGateway } else { @@ -68,6 +70,9 @@ function Edit-ZertoVra { $vraNetwork['VraIPConfigurationTypeApi'] = "Static" # Add network information to update object. $vraUpdate['VraNetworkDataApi'] = $vraNetwork + } else { + $vraNetwork['VraIPConfigurationTypeApi'] = "Dhcp" + $vraUpdate['VraNetworkDataApi'] = $vraNetwork } # -WhatIf processing and submit! if ($PSCmdlet.ShouldProcess( "Updating " + $vra.vraName + " with these settings: $($vraUpdate | convertTo-Json)")) {