VMware Cloud Community
gamename
Enthusiast
Enthusiast
Jump to solution

Deleting VMs - Best Practices?

Hi,

I'm confused about exactly how a vm should be deleted.

Most of the time, this works fine:

get-vm red_tunic | stop-vm -confirm:$false -erroraction SilentlyContinue | remove-vm -deletepermanently -runasync -confirm:$false

However, if "red_tunic" has a snapshot, it may not actually delete.  But it will delete after removing the snapshot:

get-vm red_tunic | get-snapshot | remove-snapshot -confirm:$false

Is this expected behavior? Should not 'remove-vm' also delete snapshots?

My powerCLI version is:

----------------

   VMware vSphere PowerCLI 5.1 Release 2 build 1012425

---------------

Snapin Versions

---------------

   VMWare AutoDeploy PowerCLI Component 5.1 build 768137

   VMWare ImageBuilder PowerCLI Component 5.1 build 768137

   VMware vCloud Director PowerCLI Component 5.1 build 1012427

   VMware License PowerCLI Component 5.1 build 669840

   VMware VDS PowerCLI Component 5.1 build 1012428

   VMware vSphere PowerCLI Component 5.1 build 1012428

Thanks,

-T

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

For me the Remove-VM seems to work as well for VMs with snapshots.

What do you mean by "may" ? Does it work sometimes ?

Any messages on screen or in vCenter for the failed Remove-VM ?


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

For me the Remove-VM seems to work as well for VMs with snapshots.

What do you mean by "may" ? Does it work sometimes ?

Any messages on screen or in vCenter for the failed Remove-VM ?


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

0 Kudos
gamename
Enthusiast
Enthusiast
Jump to solution

Hi Luc,

Correct.  A couple times it has not worked to do a remove-vm.  There was no message. If it happens again, I'll get some diagnostics.

0 Kudos