PowerCLI: Cloning and Deleting VMs

In addition to monitoring, managing VMs is a key task for administrators. Below are simple PowerCLI commands for cloning and deleting VMs.

Cloning a VM

$sourceVM = Get-VM -Name "template-vm"
$targetHost = Get-VMHost -Name "esxi-host-01"
$datastore = Get-Datastore -VMHost $targetHost | Where-Object {$_.Name -like "vsanDatastore"}

New-VM -Name "cloned-vm" `
       -VM $sourceVM `
       -VMHost $targetHost `
       -Datastore $datastore `
       -ResourcePool ($targetHost | Get-ResourcePool)

Deleting a VM

Get-VM -Name "cloned-vm" | Remove-VM -DeletePermanently -Confirm:$false

These commands are especially useful for lab environments or when automating template-based VM provisioning.


Conclusion Use this PowerShell command as part of your regular cluster health checks. When combined with vCenter’s vSAN resync and health dashboards, it gives you the full picture to maintain optimal performance and avoid storage imbalances.

Stay tuned for a follow-up post on triggering manual rebalancing using RVC (Ruby vSphere Console).

© 2012–2025 Jet Mariano. All rights reserved.
For usage terms, please see the Legal Disclaimer.

error: Content is protected !!