Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
powercli - Delete multiple VM’s
Get-Module -ListAvailable *vm*|Import-Module
Connect-VIServer vcenter02 -Credential $cred
$deletevmlist=Get-Content C:\temp\delete.txt
foreach($deletevm in $deletevmlist)
write-output ("$deletevm is deleting...")
get-cluster cluster02|get-vm $deletevm |Remove-VM -DeletePermanently -Confirm:$false -RunAsync| out-null
Start-Sleep 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment