VMware Cloud Community
akohistani
Contributor
Contributor

Update Full Clone Pool Template with Set-HVPool

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 

0 Kudos
8 Replies
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
akohistani
Contributor
Contributor

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)?

0 Kudos
LucD
Leadership
Leadership

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

See also #Issue83 in the repo.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
akohistani
Contributor
Contributor

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'
0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
akohistani
Contributor
Contributor

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

 

0 Kudos
LucD
Leadership
Leadership

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


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
mavensupport
Contributor
Contributor

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?
0 Kudos