Skip to content

Instantly share code, notes, and snippets.

@goffinet
Created December 12, 2016 22:40
Show Gist options
  • Select an option

  • Save goffinet/7e9ad5cbf72d431b4a215eae48ef7962 to your computer and use it in GitHub Desktop.

Select an option

Save goffinet/7e9ad5cbf72d431b4a215eae48ef7962 to your computer and use it in GitHub Desktop.
Remove vm by name with disk**s**
#
$VMname = 'TESTVM'
GET-VM –Name $VMname | GET-VMHardDiskDrive | Foreach { STOP-VM –Name $_.VMname; Remove-item –path $_.Path; REMOVE-VM –Name $_.VMname -Force }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment