Hello,
i have the following powershell script which creates muliple VMs (see below)
My questions is:
which powershell script should i write in order to delete the VMs i created.
e.g. i created 20 VMs by the script below and now i want to remove all of them.
thanks in advance.
[int]$VMcount =Read-host “InputNumber of VMs” $Templatename =Read-host "Input VMTemplate Name" $VMTemplate =Get-SCVMTemplate|where{$_.Name-eq "$Templatename"} $VMName =Read-host “InputBaseName” $Hostname =Read-host "Input Host Name" $VMHost =Get-SCVMHost-ComputerName $Hostname $VMPath =Read-host "Input VM Path (example: C:\Clusterstorage\Volume1)" $Total =1While($total -le $VMCount){$NewVMName =“$VMName-”+ $totalWrite-Output $virtualMachineConfigurationNew-SCVirtualMachine-Name $NewVMName -VMHost"$VMHost"-path "$VMPath"-VMTemplate"$VMTemplate"-ReturnImmediately-DelayStartSeconds“0" $Total++ }