I'm trying to update the size of Distribute cache but keep getting the below error:

"set-cachehostconfig : Object reference not set to an instance of an object. At line:1 char:1 + set-cachehostconfig -CacheSize 1228 -cacheport 22233 -hostname usa0300vm1160 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Set-AFCacheHostConfiguration] , NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Applicat ionServer.Caching.Commands.SetAFCacheHostConfigurationCommand"**

Distributed cache is running on only one server(out of 3).

I even tried Update-SPDistributedCacheSize but get the same error.

  • did you try this blogs.technet.com/b/sp/archive/2013/05/29/… Mar 22, 2016 at 8:35
  • check this too nikpatel.net/2013/09/26/… Mar 22, 2016 at 8:36
  • @KarthikJaganathan I use the same command and approach as described in both articles but get only error message
    – George
    Mar 22, 2016 at 8:54
  • Are you running this on a host with DC deployed? Do you have >1 DC server, if so, drop down to one before running the cmdlet.
    – Trevor Seward
    Mar 22, 2016 at 14:13
  • @TrevorSeward Yes,I'm running on a host with DC deployed and i have only one server where DC is enabled. Even on a standalone Dev machine,I get this error while updating the cache size
    – George
    Mar 22, 2016 at 14:24

1 Answer 1


After lot of tries,I finally updated the Distributed Cache size.

I used the following commands multiple times in the same order: Give 2 minutes gap between Remove and Add commands

Stop-SPDistributedCacheServiceInstance -Graceful

$instanceName ="SPDistributedCacheService Name=AppFabricCachingService" 
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername} 




Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.