There are two App Fabric PowerShell Modules that SharePoint (2013+) uses for all Distributed Cache commands. They are located here:
- C:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules\DistributedCacheAdministration\DistributedCacheAdministration.psm1
- C:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules\DistributedCacheConfiguration\DistributedCacheConfiguration.psm1
— If there are problems with these modules, certain (or all) Distributed Cache PowerShell commands may fail to run with error:
The term ‘<cmd-let you tried to run>’ is not recognized as the name of a cmdlet, function, script file, or operable program.
If that happens, you should check:
- That you have the Distributed Cache SharePoint service (which is the “AppFabric Caching Service” in services.msc) running on the machine.
- That the modules exist in the proper location and that they have not been modified.
Or, you can use PowerShell to check the contents of PSModulePath:
Get-Childitem env:PSModulePath | fl
It should contain “c:\Program Files\AppFabric 1.1 for Windows Server\PowershellModules” in the path.
If it does not, you may need to manually add the path to the PSModulePath environment variable. This is something that should be added during SharePoint installation. I’m not sure how or why it goes missing, but I’ve seen it happen a few times.