VMware Cloud Community
b1naryagent
Contributor
Contributor

Move-Template Error

Vcenter 5.5 U1

PowerCli 5.5 R2

PowerShell 3.0

PowerCLI C:\> Move-Template -Template "Win2003 ENT R2 SP2 x64 10.7.124.x" -Destination esxhost110.blah.pvt  -WhatIf

Move-Template : Unable to cast object of type 'VMware.VimAutomation.ViCore.Util10.Surrogate.DefaultValue.StringWrapperFolder' to type 'VMware.VimAutomation.ViCore.Interop.V1.VIObjectCoreInterop'.

At line:1 char:14

+ Move-Template <<<<  -Destination esxhost110.blah.pvt -Template "Win2003 ENT R2 SP2 x64 10.7.124.x" -WhatIf

    + CategoryInfo          : NotSpecified: (:) [Move-Template], InvalidCastException

    + FullyQualifiedErrorId : System.InvalidCastException,VMware.VimAutomation.ViCore.Cmdlets.Commands.MoveTemplate

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership

The Move-Template cmdlet doesn't accept a string as a value for the Template parameter, there is no OBN for that parameter.

You'll have to pass an object returned by Get-Template.


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

Reply
0 Kudos
b1naryagent
Contributor
Contributor

I had also tried:

Get-Template "Win2003 ENT R2 SP2 x64 10.7.124.x" | Move-Template -Destination esxhost110.blah.pvt

That command passes the template object via the pipeline to the input of move-template but I received the same error.

Also, I was informed by my teammates that you can't move templates across ESX hosts and that they must be converted to VM's first. With that information I was able to move the templates.

My concern here is that the documentation for move-template specifies that the Destination parameter can be any VIContainer which includes "folder, host, cluster, or resource pool". Nowhere does it mention any restriction on the destination in regards to what type of VIContainer can be specified. This is woefully unacceptable.

Reply
0 Kudos