Error occurred in deployment step ‘Recycle IIS Application Pool’: Invalid namespace
If you ever encounter this error with a SharePoint 2010 Environment on Windows 7, Ensure, you enable this: Internet Information Services -> Web Management Tools -> IIS 6 Management Compatibility -> IIS 6 WMI Compatibility
# Run (copy/paste) this to SharePoint PowerShell (as admin)
ReplyDelete# Thanks to Raka Satria
# https://rakatechblog.wordpress.com/2013/02/04/sharepoint-2013-spdistributedcacheserviceinstance-cachehostinfo-is-null/
$SPFarm = Get-SPFarm
$cacheClusterName = "SPDistributedCacheCluster_" + $SPFarm.Id.ToString()
$cacheClusterManager = [Microsoft.SharePoint.DistributedCaching.Utilities.SPDistributedCacheClusterInfoManager]::Local
$cacheClusterInfo = $cacheClusterManager.GetSPDistributedCacheClusterInfo($cacheClusterName);
$instanceName ="SPDistributedCacheService Name=AppFabricCachingService"
$serviceInstance = Get-SPServiceInstance | ? {($_.Service.Tostring()) -eq $instanceName -and ($_.Server.Name) -eq $env:computername}
if([System.String]::IsNullOrEmpty($cacheClusterInfo.CacheHostsInfoCollection))
{
#here's the key. we can't provision, unprovision, start, or stop a Cache Service because we still have a Cache Service that have no server attached
$serviceInstance.Delete()
Add-SPDistributedCacheServiceInstance
$cacheClusterInfo.CacheHostsInfoCollection
}