I ran into an interesting issue while onsite with a customer the other week and I thought maybe someone else could benefit from this. The scenario had to do with the Distributed Cache and we were trying to correct some issues that they had.
The basic steps were to Remove/Add the SPDistributedCacheServiceInstance using powershell (PS) in order to 'fix' it. When we executed the Add-* PS cmdlet we ended up seeing the following error:
This was most vexing as the user running the PS cmdlet was a Farm Admin and local admin on the server in question. I consulted with several of my peers when it occurred to one of them that the referenced path appeared quite interesting:
The actual user account was not test18172account, but was test$account. Now if you have done your homework, there is a specific supportability statement with regards to SharePoint service accounts:
Do not use service account names that contain the symbol $.
So there is a small bit of room for discussion about this since the article states "service account names" and in this scenario we weren't using a service account. However, as it turns out this restriction apparently applies to accounts used running certain PS cmdlets.
As soon as we moved to another admin account that didn't contain a $ everything worked as expected. So the morale of the story is to avoid using special characters in your account names -- or at least $ (dollar signs). 🙂
Reposting the error in text for search-ability:
Add-SPDistributedCacheServiceInstance : Could not find a part of the path
At line:1 char:1
+ CategoryInfo : InvalidData: (Microsoft.Share...ServiceInstance:SPCmdletAddDist...ServiceInstance) [Add-
+ FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletAddDistributedCacheServiceInstance