I'm trying to grab the Distributed Cache service using PowerShell so I can change the managed account that runs it. This cannot be changed through the CA UI.

I am not able to get the service using any of the following PowerShell commands (they return a null object).

$farm is set using $farm = get-spfarm

$farm.services | where ($_.TypeName -eq "Distributed Cache")

$farm.services | where ($_.Id -eq "<The GUID of the distributed cache service>")

$farm.services | where ($_.TypeName -match "Distributed"

$farm.services | where ($_.TypeName -like "*Distributed*")

I am running PowerShell as a local administrator and as the farm administrator. Again, all of these lines return a null object. AFAIK any of these should get me the cache service. I can see it listed when I just enter $farm.services but somehow the pipe-filtering (?) is not working properly.

I'm not able to get any of the other services using this method.


Try this one, the service called App fabric.

$farm = Get-SPFarm
$cacheService = $farm.Services | where {$_.Name -eq "AppFabricCachingService"}
$accnt = Get-SPManagedAccount -Identity domain_name\user_name
$cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser"
$cacheService.ProcessIdentity.ManagedAccount = $accnt

MSFT Official Article on this. http://technet.microsoft.com/en-us/library/jj219613.aspx#changesvcacct

| improve this answer | |
  • I SWEAR I was using that EXACT script earlier! Strangely it worked though. Thanks. – tnw Jan 13 '14 at 18:43
  • dont worry, i have magic...:) glad its fixed. – Waqas Sarwar MVP Jan 13 '14 at 18:49

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.