Getting Use-CacheCluster to work on a SharePoint server without the AppFabric Distributed Cache Role/Component

By | 2016-08-12

You probably have encountered it already some time ago. You want to check the status of your Distributed Cache Cluster and you login to a back-end server where there is no Distributed Cache component.
You open up Powershell and start with Use-CacheCluster. It fails. You failed. You need to login to a server which is an active member of the Distributed Cache Cluster to get the status, configuration, etc.

Now there is a simple solution which does not effect your application.

 

Some examples you might get when trying to connect to the AppFabric Distributed Cache cluster from a SharePoint server:

 

I have been on a gooze chase for a while because of articles like this:


 

use-cachecluster
use-cachecluster -Provider “System.Data.SqlClient” -ConnectionString “Data Source=dbmachine\instance;Initial Catalog=DatabaseName;Integrated Security=true”

http://blog.milrr.com/2012/05/code-appfabric-diagnostic-powershell.html


 

Use-CacheCluster
Sets the context of your Windows PowerShell session to the desired cache cluster.

When you start a Windows PowerShell session, you must first run this command. If it is on a cache host, you run the command with no parameters, because the parameters are taken from the cache configuration on the computer. If you are running it from a non-host computer, you can use the parameters below to specify the desired cache cluster.

Parameter (alias) descriptions are as follows:

Provider (P): The provider that is used to store the cluster configuration settings. This can be eitherSystem.Data.SqlClient or XML depending on how the configuration information is stored.
ConnectionString (C): The connection string to the database or location of the XML configuration file.

https://msdn.microsoft.com/en-us/library/ff718177(v=azure.10).aspx


 

 

How to do it

Thankfully, there is a solution:
The Use-CacheCluster can be helped with the directions where to find the cluster configuration. All it needs is some registry entries.
No problems or errors will occur, you are not activating services or changing the config within SharePoint. Just the registry on the server(s) where you want to be able to look at the Cache Cluster.
This is, because every SharePoint 2013 server gets the same AppFabric installation, because its a prerequisite component.
That means the Powershell modules, DLL files and basic registry entries are already in place.

We only need to add a few properties.

 

We can create these very easy:

 

Now, when we use Use-CacheCluster on a SharePoint 2013 server where Distributed Cache is not configured, it works!

 

2 thoughts on “Getting Use-CacheCluster to work on a SharePoint server without the AppFabric Distributed Cache Role/Component

  1. Arash Aghajani

    Thanks Wouter!
    You saved my time. Your solution works like a charm! 🙂

    Reply
  2. TeeJay

    Thanks since more or less I work on the same issue but I did not find the complete solution.

    Your solution is Awesome and completed you save my time thanks a lot

    Regards

    Reply

Leave a Reply

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