Remove-VM : The operation cannot be performed

EXCHANGE replica (on v1) was in a hung resynching state (off)…
running in production with replication removed (on v2)…
to re-enable replication, a VM cannot exist on the replica server which has the same GUID…
(you have to remove the replica VM)

BUT, since the replica was in a hung resync state, the remove feature was unavailable…
errored out when tried in PS as well

… Googs to the rescue …

Steps (in remote powershell session) (in new SVR MGR -> right click SVR -> Windows Powershell):

[MIKROV1.dom.local]: PS C:\Users\mikrodots\Documents> get-vm -name EXCHANGE|fl *
VMName : EXCHANGE
VMId : df6g5857-8f0c-43c1-af71-fd4302afcf5f

[MIKROV1.dom.local]: PS C:\Users\mikrodots\Documents> get-vm -name EXCHANGE | Remove-VM
Confirm
Are you sure you want to remove virtual machine “EXCHANGE”?
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (default is “Y”): y
Remove-VM : The operation cannot be performed while the virtual machine is in its current state. The name of the
virtual machine is EXCHANGE and its ID is df6g5857-8f0c-43c1-af71-fd4302afcf5f.
+ CategoryInfo : InvalidResult: (:) [Remove-VM], VirtualizationOperationFailedException
+ FullyQualifiedErrorId : InvalidState,Microsoft.HyperV.PowerShell.Commands.RemoveVMCommand

[MIKROV1.dom.local]: PS C:\Users\mikrodots\Documents> mkdir c:\vmxmlbak
[MIKROV1.dom.local]: PS C:\Users\mikrodots\Documents> cd “C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines”
[MIKROV1.dom.local]: PS C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines> ls
Directory: C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines
Mode LastWriteTime Length Name
—- ————- —— —-
d—- 10/3/2014 2:52 PM Locks
-a— 9/2/2014 3:28 PM 0 43EDAA33-9FEE-4E1B-8267-8778479F1D67.xml
-a— 8/7/2014 4:57 PM 0 49ED3EE8-7B0F-459D-838D-B5DFAC2AA945.xml

[MIKROV1.dom.local]: PS C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines> get-vm -name EXCHANGE | fl id
Id : df6g5857-8f0c-43c1-af71-fd4302afcf5f

[MIKROV1.dom.local]: PS C:\ProgramData\Microsoft\Windows\Hyper-V\Virtual Machines> move df6g5857-8f0c-43c1-af71-fd4302afcf5f.xml C:\vmxmlbak\

After that, I was able to re-enable replication from V2 to V1

Leave a Reply

Your email address will not be published. Required fields are marked *