, , , , ,

Cannot remove Hyper-V Host from SCVMM

1–2 minutes
15 comments on Cannot remove Hyper-V Host from SCVMM

System Center Logo

Today I run in to the problem where I could not remove a Hyper-V Hosts from System Center Virtual Machine Manager. The Hyper-V host was reinstalled before he was removed from SCVMM and the host was showing has HOSTNAME (pending) in the SCVMM Management Console. If you did a right click to remove the host, the Remove option was greyed out.

But don’t worry Windows PowerShell came to the rescue, with the following command you can remove the Hyper-V host from Virtual Machine Manager.


Get-SCVMHost <HOSTNAME> | Remove-SCVMHost -force

15 responses

  1. CypherBit Avatar
    CypherBit

    I wish it was as simple when it comes to removing a vCenter server that no longer exists.

    1. Thomas Maurer Avatar

      I never had problems, do you have any issues?

  2. Rick T Avatar
    Rick T

    When I ran the get host I get an error “no such host is known”. I evicted the node from the cluster but I am unable to remove it from VMM 2012. The host just has a pending status.

    1. Thomas Maurer Avatar

      Well I had another scenario where I could only remove the Hyper-V Server in the SCVMM DB directly. I would recommend calling Microsoft support for this :)

  3. Thomas Kaltmeyer Avatar
    Thomas Kaltmeyer

    Any news on that? We have also the need to directly remove a Hyper-V Server in the SCVMM 2012 SP1 UR3 database. Did you get a how to for removing the Hyper-V Server?

  4. Thomas Maurer Avatar

    I think I found a solution for your problem.
    Open the Powershell Command Promot as Administrator (not from SCVMM)

    Import the Virtual Machine Manager Module
    Import-Module virtualmachinemanager

    try again the command I posted in this blog post.

  5. W4yne Avatar

    Had this exact issue today, script worked great. Thanks.

  6. Sven Avatar

    Hi,

    unfortunately it doesn’t work always. In my case I getting the error that the ‘Machine is not associated with this VMM management server’.
    Associate-VMHost associate successfully, but if i than try to delete the host again, the same message comes up.
    Any other ideas?

  7. ichwanzo Avatar
    ichwanzo

    Hi..

    i want to remove fail host too, but the host is the member of hyper-v cluster. can i safely remove the failed host without affecting the cluster?

    Thanks

  8. Sven Avatar

    Hi Ichwanzo,

    Is that host still a real member of the cluster?

    If yes, I would try to remove the cluster from VMM. Check if the VMM agent is removed from the host and than add it again.

    Sven

  9. Sven Avatar

    btw

    I was able to remove a node out of VMM. That didn’t effect the cluster, the cluster was still fine. But you will need to use PowerShell to bring the Node back into VMM again without removing the whole cluster from VMM.

    To add the node via PowerShell to VMM and the cluster use this:
    $cl = Get-SCVMHostCluster
    $credentials = Get-Credential
    add-scvmhost -Credential $credentials -VMHostCluster $cl

    Sven

    1. Thomas Maurer Avatar

      I think in the most cases you can also use the UI to add it back to VMM. The wording is kind of strange but with “Add host to cluster” it just installs the agent on the Hyper-V Host

  10. Bryan Rogers Avatar
    Bryan Rogers

    I have a VM host that I was trying to remove from VMM 2012. The VMM service crashed while host was in process of removal, and now the host is in “pending” status. I have tried using the GUI and Powershell commands such as in this article. Every time, no matter what method, the VMM service crashes when attempting to remove now.

    I am guessing at this point my only option is to delete from SQL DB manually, but I am not sure which tables to look and which fields to delete so that nothing else is affected.

    Any help would be appreciated.

  11. Roscof Avatar

    Hello,

    I has a similar problem : I re install my host from scratch without having removed it from SCVMM. after the re installation I was not able to do any actions on my host from VMM. I tried to remove it with CMD line but there were always errors.
    I realized that I was not able to do any actions on my host because the VMM local agent was not installed…I guess this agent is usually set up when the host is add to a cluster.

    Having add this agent my host is working properly and I can remove it from my cluster if I want to.

  12. Ahmed Essam Avatar
    Ahmed Essam

    Get-SCVMHost <HOSTNAME> | Remove-SCVMHost -force

    The above command does not work it getting me errors

    I used Get-SCVMHost HOSTNAME | Remove-SCVMHost -force

    and it works fine

    thanks,

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.