PowerCLI

 View Only
  • 1.  Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 11:41 AM

    I am trying to update a full clone automated desktop pools template using Set-HVPool but facing an issue.
    Am I doing it the wrong way?

     

    Set-HVPool -PoolName 'MyPool' -Key '.AutomatedDesktopData.VirtualCenterNamesData.TemplatePath' -Value '/CLS/vm/MyTemplate'
    Exception calling "Desktop_Update" with "3" argument(s): "ExceptionType : VMware.Hv.InvalidArgument
    ErrorMessage : Invalid member name.
    ParameterName : .AutomatedDesktopData.VirtualCenterNamesData.TemplatePath"
    At \PowerCLI-Example-Scripts\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6442 char:8
    +        $desktop_helper.Desktop_Update($services,$item,$updates)
    +        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : VimException

     

     to up 



  • 2.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 11:44 AM

    Did you check the case of the letters?
    See also Horizon 7 Pool changes via Powercli - VMware Technology Network VMTN



  • 3.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 12:01 PM

    Yes I checked the case and it looks good.

    I even tried to retrieve data using the following which works.

    (Get-HVPool -PoolName 'MyPool').AutomatedDesktopData.VirtualCenterNamesData

     

    In the HV Admin GUI whenever I change the Template for the pool I need to re specifiy HostOrClusterPath, ResourcePoolPath and DatastorePath.

    I tried something similar here just added multiple -Key '' -Value '' in my command but it looks that Set-HVPool does not support multiple Key,Value pairs.

    Is there a way to update multiple values of the pool data at once? (TemplatePath, HostOrClusterPath, ResourcePoolPath, DatastorePath)?



  • 4.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 12:36 PM

    The code you provided does not seem to have the correct case though.

    See also #Issue83 in the repo.



  • 5.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 12:57 PM

    Yes it looks like that after I see the link you sent but the results are the same even when I try like below:

     

    Set-HVPool -PoolName 'MyPool' -Key '.automatedDesktopData.virtualCenterNamesData.templatePath' -Value '/CLS/vm/MyTemplate'


  • 6.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 01:00 PM

    Why do you have that dot in front of the Key?



  • 7.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 01:15 PM

    I was following an example from a different forum my bad 

    Here is the results when i tried without the dot in the beginning:

    Exception calling "Desktop_Update" with "3" argument(s): "ExceptionType : VMware.Hv.InvalidArgument
    ErrorMessage : Cannot update read-only member.
    ParameterName : automatedDesktopData.virtualCenterNamesData.templatePath"
    At \PowerCLI-Example-Scripts\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6442 char:8
    +        $desktop_helper.Desktop_Update($services,$item,$updates)
    +        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : VimException

     



  • 8.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Dec 28, 2021 01:29 PM

    The templatePath property in the DesktopVirtualCenterData object is indeed read-only, hence the error.

    template.png

    I think the correct key is mentioned in #Issue371



  • 9.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted Mar 22, 2022 01:35 PM

    Im having a similar issue.

    When i try update the template i get a error regardless of the object i try update. The get command works fine and i see a template and id

    $pool = Get-HVPool -PoolName IX_TESTING_20H2
    $pool.automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterProvisioningData.Template
    $pool.AutomatedDesktopData.VirtualCenterNamesData.TemplatePath

     

    Exception calling "Desktop_Update" with "3" argument(s): "ExceptionType : VMware.Hv.InvalidArgument
    ErrorMessage : Invalid member name.
    ParameterName : automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterProvisioningData.Template"
    At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6450 char:8
    + $desktop_helper.Desktop_Update($services,$item,$updates)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : VimException

    I have tried these commands

    Set-HVPool -PoolName 'IT_TESTING' -Key 'automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterProvisioningData.Template' -Value 'VmTemplate/MDcyMzg4OTMtNTk4Ni00OGIyLThkZDItNmE5YzA0MmQwNDUz/NjljNzkyMTItZjljNC00NjYwLTk3MjctMzJkOTc3NjZkNTZj/L0lYIFZESSBDTFVTVEVSL3ZtL0JVSUxEL1cxMF8yMEgyL1dpbjEwXzIwSDJfQmFzZV9NYXN0ZXIwMQ'
     
    Set-HVPool -PoolName 'IT_TESTING' -Key 'automatedDesktopData.virtualCenterProvisioningSettings.virtualCenterProvisioningData.Template' -Value '/VDI CLUSTER/vm/BUILD/Win10_20H2_Base_Master01'
     
    Any ideas?


  • 10.  RE: Update Full Clone Pool Template with Set-HVPool

    Posted 22 days ago

    Hi did anyone ever get this to work correctly?