Unable To Remove Server From Farm / cacheHostInfo is null

If you run into issues trying to remove a server from your SharePoint 2013 farm, particularly where you think the AppFabric install on that server is corruped/unfixable and you want to reinstall. Try the following. It worked for me.

1) Run the SP13 Configuration Wizard on the server you want to remove from the farm. Choose “Disconnect from Farm.”

2) After it finishes, head over to your Central Admin server.

3) Browse to “Servers In Farm” and see if the server you just removed is still there.

4) If it is still there, try clicking “Remove Server.”  This is where I got an error message indicating “cacheHostInfo is null,” and it would not let me proceed any further. This is because the server is still registered with the cache cluster and it is trying to remove it, but since the server has a bad/no entry for the cache info, it fails.

5) Fortunately, the server can be manually removed from the cache cluster through Powershell. While still on your Central Admin server, run the following script:

$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName)
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq "ComputerToRemoveName1"}
$serviceInstance.Delete()

Verify it is removed by running:

$cacheClusterInfo.CacheHostsInfoCollection
Posted in SharePoint 2013.

Leave a Reply

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