Created
March 24, 2023 08:19
-
-
Save viceice/9560b2972ad1fa6a924779e36fdaf84a to your computer and use it in GitHub Desktop.
HyperV: Delete a failed planned VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory)] | |
[string]$Name | |
) | |
$vmms = Get-WmiObject -Namespace root\virtualization\v2 -Class Msvm_VirtualSystemManagementService | |
$pvm = Get-WmiObject -Namespace root\virtualization\v2 -Query "Select * From Msvm_PlannedComputerSystem where elementname='${Name}'" | |
$vmms.DestroySystem($pvm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment