SharePoint 2013: Cannot Remove Server from Farm: cacheHostInfo is Null

Problem: Customer was trying to remove a server from the farm via the ‘Remove Server’ link in Central Administration. Every time they would try this, they would receive an error that said ‘cacheHostInfo is Null’

Troubleshooting:

  • Right away, from experience, I knew this had to do with improper removal of a server from a farm that is running Distribution Cache service. But to verify I asked to look at the ‘Services in this Farm’ page. Then we tried trying to turn that service off on the problem server but it also failed with same error cacheHostInfo is Null

Resolution

  • Login to your server with your setup account (Whats a setup account?)

  • Launch SharePoint Powershell (Run as Administrator)

  • Run this command: Get-spserviceinstance | where{$_.parent -match "name_of_server_you_removed"}

  • You’ll see something like this, you want to copy the ID:

    TypeName : Distributed Cache
                DisplayName : Distributed Cache Service Instance
                Description : Distributed cache service to store the cached items in memory.
                Server : SPServer Name=MySPServer
                Service : SPDistributedCacheService Name=AppFabricCachingService
                Instance :
                Roles :
                Hidden : False
                SystemService : False
                ManageLink : Microsoft.SharePoint.Administration.SPActionLink
                ProvisionLink : Microsoft.SharePoint.Administration.SPActionLink
                UnprovisionLink : Microsoft.SharePoint.Administration.SPActionLink
                CanUpgrade : False
                IsBackwardsCompatible : True
                NeedsUpgradeIncludeChildren : True
                NeedsUpgrade : True
                UpgradeContext : Microsoft.SharePoint.Upgrade.SPUpgradeContext
                Name :
                Id : 62d294e4-b7ez-4cd7-9btt-384c98574e2f
                Status : Disabled
                Parent : SPServer Name=MySPServer
                Version : 8576
                Properties : {}
                Farm : SPFarm Name=SharePoint_Config_2013
                UpgradedPersistedProperties : {}

  • $instance = get-spserviceinstance 62d294e4-b7ez-4cd7-9btt-384c98574e2f

  • $instance.Unprovision()
    (it may fail with the same cacheHostInfo is Null so try this command:
    $instance.Delete()

  • After it completes successfully, you can then go into Central Admin >>Manage Servers in this Farm and click the ‘Remove Server’ link to remove your server

Stay tuned for an article on How to Properly Remove a Server running Distribution Cache from your Farm.