VMware Cloud Community
rootic
Contributor
Contributor
Jump to solution

Correctly remove template

Hello, I have the next problem:

I need to remove template from vCenter via powerCLI, such as i would click mouse2 on template and choose "Delete from Disk".

When I try to do it using this code:

$Templates = Get-Template $TemplateName

Remove-Template $Templates -DeletePermanently -Confirm:$false

template is removed from inventory and all template's files are removed except .vmdk. So, template's folder on datastore and .vmdk file is steel kept.

How can I remove template and all it's files permanently? Do i need to delete folder on datastore separately on the next step? If so, how can I do it? (can't find commandlet for it)

0 Kudos
1 Solution

Accepted Solutions
rootic
Contributor
Contributor
Jump to solution

An issue has been resolved. As I understood

Remove-Template $Templates -DeletePermanently -Confirm:$false

work only if $Templates include 1 template, or several different templates. In my case $Templates included 3 objects that relate with 1 template. There were 3 because of I added them to inventory of 2 additional DataCenters.

View solution in original post

0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

Which PowerCLI version are you using (do a Get-PowerCLIVersion) ?


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

0 Kudos
rootic
Contributor
Contributor
Jump to solution

VMware vSphere PowerCLI 5.5 Release 1 build 1295336

0 Kudos
rootic
Contributor
Contributor
Jump to solution

An issue has been resolved. As I understood

Remove-Template $Templates -DeletePermanently -Confirm:$false

work only if $Templates include 1 template, or several different templates. In my case $Templates included 3 objects that relate with 1 template. There were 3 because of I added them to inventory of 2 additional DataCenters.

0 Kudos