Skip to content

Commit

Permalink
Create destroy-clone.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinGavanda committed Jun 25, 2018
1 parent e667d09 commit 4cbf994
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions destroy-clone.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<#
.NOTES
===========================================================================
Created by: Martin Gavanda
Date: Apr 29, 2018
WWW: www.learnvmware.online
===========================================================================
.SYNOPSIS
Sample script to cleanup environment from previous Insta Clone VMs
.DESCRIPTION
Destroy 20 new Inte Clone VMs deployed by deploy-clone.ps1
#>

Connect-VIServer -server 172.16.1.100 -user "administrator@vsphere.local" -password "MyPassword"
foreach ($i in 1..20){

$newVM="InstaClone"+$i


### DO NOT EDIT BEYOND HERE ###

Get-VM -name "$newVM" | Stop-VM -Confirm:$false
}

foreach ($i in 1..20){

$newVM="InstaClone"+$i
Remove-VM $newVM -DeleteFromDisk -Confirm:$false
}
Disconnect-VIServer -Confirm:$false

0 comments on commit 4cbf994

Please sign in to comment.