PowerCLI-Example-Scripts icon indicating copy to clipboard operation
PowerCLI-Example-Scripts copied to clipboard

set-hvpool to update pool settings using json file gives an error

Open Munipagadala opened this issue 6 years ago • 4 comments
trafficstars

The power shell error: Get-MapEntry : Cannot bind argument to parameter 'Value' because it is null. At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6274 char:59

  • ... $updates += Get-MapEntry -key $member.name -value $member.value
  •                                                         ~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Get-MapEntry], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Get-MapEntry

Get-MapEntry : Cannot bind argument to parameter 'Value' because it is null. At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6274 char:59

  • ... $updates += Get-MapEntry -key $member.name -value $member.value
  •                                                         ~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Get-MapEntry], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Get-MapEntry

Get-MapEntry : Cannot bind argument to parameter 'Value' because it is null. At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6274 char:59

  • ... $updates += Get-MapEntry -key $member.name -value $member.value
  •                                                         ~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Get-MapEntry], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Get-MapEntry

Updating the Pool: VDI_Patch_test Exception calling "Desktop_Update" with "3" argument(s): "There was an error in serializing body of message Desktop_UpdateRequest: 'There was an error generating the XML document.'. Please see InnerException for more details." At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6334 char:8

  •    $desktop_helper.Desktop_Update($services,$item,$updates)
    
  •    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : CommunicationException

Munipagadala avatar May 08 '19 07:05 Munipagadala

is there a change in Key value? I am getting below error while updating value for the key Power Policy.

PS C:> Set-HVPool -PoolName 'VDI_Patch_test' -key 'DesktopSettings.LogoffSettings.PowerPolicy' -value "POWER_OFF" Updating the Pool: VDI_Patch_test Exception calling "Desktop_Update" with "3" argument(s): "ExceptionType : VMware.Hv.InvalidArgument ErrorMessage : Invalid member name. ParameterName : DesktopSettings.LogoffSettings.PowerPolicy" At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6334 char:8

  •    $desktop_helper.Desktop_Update($services,$item,$updates)
    
  •    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : VimException

Munipagadala avatar May 09 '19 00:05 Munipagadala

I Also get the same kind of error when trying to deploy a new VDI Pool.

Exception calling "Desktop_Create" with "2" argument(s): "There is an error in the XML document." At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:4887 char:7

  •   $id = $desktop_helper.Desktop_create($services,$desktopSpecObj)
    
  •   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : InvalidOperationException

smoonlee avatar May 09 '19 08:05 smoonlee

Can you post your JSON file? This error is typically due to a typo or syntax issue.

In regards to your second comment, can you try this while changing the capitalization? The ViewAPI is picky about that.

Set-HVPool -PoolName 'VDI_Patch_test' -key 'desktopSettings.LogoffSettings.PowerPolicy' -value "POWER_OFF"

CajunBard avatar May 09 '19 15:05 CajunBard

We've see these errors when using a json file created Hv.Helper from an existing pool, though we're only getting 2 of them. In analyzing the file created from Get-HVPoolSpec -FilePath, the errors seem to stem from the existence of "ManualDesktopSpec" and "RdsDesktopSpec" at the bottom of the file with null values. Removing those two lines resolves the failure for us when using Set-HVPool -Spec

I know this is an old issue and our experience may not be the same as the OP, but worth noting either way.

bfett20 avatar Feb 19 '20 13:02 bfett20