Again, I get an error after I run “Remove-SPDistributedCacheServiceInstance”
“cacheHostInfo is null”
I can’t start Distributed Cache Service on SharePoint Central Administration, even I’ve run “Add-SPDistributedCacheServiceInstance”.
So, I realize that it happened because there is no cacheHost in SPDistributedCacheHostInfoCollaction but we can fix it with this script
here’s the 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 $env:computername}
if([System.String]::IsNullOrEmpty($cacheClusterInfo.CacheHostsInfoCollection))
{
#here's the key. we can't provision, unprovision, start, or stop a Cache Service because we still have a Cache Service that have no server attached
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection
}
and problem is solved…
Hope this is helpful
Raka Satria
Nice work! this little nugget saved my day. Now all I need is to get newsfeed to update….
Thanks, I’m really happy if my post can help you
It did! I got the Cache back to functional levels after I had managed to royally mess it up. In the end it was the simple service account permissions like 90% of all posts mention. I was just barking up the wrong tree the whole time as I had mixed up my accounts.
I was spending the whole night to figure it out. I was really happy when I found the solution. so, hope this post can also help everyone who has same problem
There are lots of cache info null posts out there. Why not post some messages on some forums? Your ps script works a charm.
Sure, I will post some message on some forums even though I did it at Technet Forum and they marked it as an answer.
Thanks, I’m just happy if i can solve my clients’ problems
How can I execute this script? I tried to save text file with ps1 extension and run with powershell but got bunch of error with red text
Please execute using SharePoint Management Shell 2012 and try to not use ps1 just copy and paste as it is, can i you post the red text ?
I get this error when I use the script. I have tried to change the user for the service but it still gives an error.
Add-SPDistributedCacheServiceInstance :
ErrorCode:SubStatus:Service running under Network
Service account in workgroup environment is not supported.
From the error you got, I know that somehow your DistributedCacheService are using NetworkService Account, Please use this script to change your service account
$CacheService = (Get-SPFarm).Services | ? {$_.Name -eq AppFabricCachingService”} $ServiceAccount = Get-SPManagedAccount -Identity "DOMAIN\FarmAccount" $CacheService.ProcessIdentity.CurrentIdentityType = “SpecificUser” $CacheService.ProcessIdentity.ManagedAccount = $ServiceAccount $CacheService.ProcessIdentity.Update() $CacheService.ProcessIdentity.Deploy()after that you can run my blog’s script
Thanks Raka for your great post, I think I am nearly there with getting my Distributed Cache Service sorted but one issue that I am having is with the line in your script above;
$ServiceAccount = Get-SPManagedAccount -Identity
This returns an error to me;
Get-SPManagedAccount : Missing an argument for parameter ‘Identity’. Specify a
parameter of type ‘Microsoft.SharePoint.PowerShell.SPManagedAccountPipeBind’
and try again.
Any suggestions?
Also in the following line of the script I presume “specific user” should be replaced with the account that the cache service process should run under. Can you confirm this.
Thanks again for the great posts.
Refer to Technet documentation ( http://technet.microsoft.com/en-us/library/jj219613.aspx#changesvcacct)
Service Account of Distributed Cache Service should be an Farm Account.
I have got this working down as far as $CacheService.ProcessIdentity.Deploy()
But now I am getting the original error returned from the command, ie cacheHostInfo is null
Any thoughts?
Please Run this
$CacheService = (Get-SPFarm).Services | ? {$_.Name -eq AppFabricCachingService”} $ServiceAccount = Get-SPManagedAccount -Identity "DOMAIN\FarmAccount" $CacheService.ProcessIdentity.CurrentIdentityType = “SpecificUser” $CacheService.ProcessIdentity.ManagedAccount = $ServiceAccount $CacheService.ProcessIdentity.Update() $CacheService.ProcessIdentity.Deploy()then this
$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 $env:computername} if([System.String]::IsNullOrEmpty($cacheClusterInfo.CacheHostsInfoCollection)) { #here's the key. we can't provision, unprovision, start, or stop a Cache Service because we still have a Cache Service that have no server attached $serviceInstance.Delete() Add-SPDistributedCacheServiceInstance $cacheClusterInfo.CacheHostsInfoCollection }Have worked through the Technet article and the script in the blog post but am being stumped by the cacheHostInfo is null message when I run the Deploy command in the above for changing the Service Account to a Farm Admin Acct.
I notice when I run Get-SPServiceInstance that the Distributed Cache Service Instance Status is Disabled and the Properties are empty (). When I try to delete the instance with
$s = Get-SPServiceInstance GUID
$s.delete()
I get OverloadDefinitions / void Delete
Really at a roadblock with this one.
Try to start the service on Central Administration SharePoint
Trying to start the Service in Central Admin is my objective but it errors with cacheInfo is null.
Appreciate your help so far.
Hmmm, I just curious what exactly happen there. If I’m there. I will do some scripts to make sure the root cause. Sorry I can’t help because I can’t imagine your problem therefore I can’t find the root cause.
Thank you Raka! This script got me out of a jam and I can now enjoy my weekend. Rock on, Brotha!
You’re welcome….
I truly enjoy studying on this site, it has excellent posts . “The great secret of power is never to will to do more than you can accomplish.” by Henrik Ibsen.
Pingback: Piano Portal
Pingback: SharePoint2013.DistributedCacheService.Neuinstallation | Tobias Wolter IT- Solutions & Consulting
Awesome work Raka!
This did the trick….
In the future I would like to reference this in my blog and give you proper credit, given you’re OK with that.
Cheers!
I am not having any issues getting the script to run, however I am still not able to start the service or remove it from my two other servers. Even when I click on app fabric setup, the two servers say “This is not a memeber for the cluster app fabric” At this point I do not need the distributed cache if I can just get it removed. But having it would be nice
Let see…
I hope this will help you out
http://rakasatria.wordpress.com/2013/02/04/sharepoint-2013-unable-to-create-a-datacache/
Raka,
I think I may have found the problem or issue, but not sure how to resolve it just yet. I noticed that in order to run distributed cache, you must use enterprise or higher. Wellllllllll I am using Server 2012 standard and of course there is not Enterprise….so not sure how to fix this yet or at least get it from showing the errors. Anyone else have any recommendations?
according to this page http://technet.microsoft.com/en-us/library/cc262485.aspx. I’m sure the problems isn’t comes from windows server version, but can I know what version you use for SharePoint? Is that SharePoint Server 2013 or Sharepoint foundation 2013?
I am using Sharepoint 2013, but I think that http://rakasatria.wordpress.com/2013/02/04/sharepoint-2013-unable-to-create-a-datacache/ may have fixed the problem. At least on one so far, trying on the second server now. You guys are awesome and much appreciated!!
Haha, I’m glad that can help you. Good Luck!
Pingback: Cannot Remove Server Reference from Farm: CacheHostInfo is null | Summit 7 Systems
Thank you very much, your script helped me tonight! Much love!
you’re welcome mike
Hi Raka when i execute your script the command Add-SPDistributedCacheServiceInstance send me this error (the first time only) “Add-SPDistributedCacheServiceInstance :
ErrorCode:SubStatus:Service running under Network
Service account in workgroup environment is not supported.
At line:1 char:1
+ Add-SPDistributedCacheServiceInstance
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Share…ServiceInstance:
SPCmdletAddDist…ServiceInstance) [Add-SPDistributedCacheServiceInstance]
, CmdletInvocationException
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddDistr
ibutedCacheServiceInstance”
then the variable “$cacheClusterInfo.CacheHostsInfoCollection” is always empty. Do you know why ?
Best regards
Hi,
Please change Distribution Cache Service from Network Service to Domain User using Central Administration.
Regards,
Raka
Hi Raka, thank you so much for your help, i think that i don’t really need Distribution cache service in my development approach. I juste want to deploy apps from VS2012 to SP2013 install on a Virtual Machine running windows server 2012. I juste wanna develop and test in a “local way”. So when i ttry to deploy a simply hello world apps i obtain this mess: “The load balancer is not provisioned. Verify the load balancer was provisioned successfully before retrieving endpoint addresses. ” and the same thing when i try to deploy my apps with sharepoint interface.
Regards
Nice Work !!