I am trying to get a list of all the app pools for a remote server. Trying to execute my code I get this error:
Retrieving the COM class factory for remote component with CLSID {2B72133B-3F5B-4602-8952-803546CE3344} from machine '{ServerName}' failed due to the following error: 800706ba
I looked at this question and followed this answer but doesn't seem to work at all.
CODE:
public static ICollection<AppPoolModel> GetServerAppPools(string serverName)
{
var appPoolList = new List<AppPoolModel>();
using (var server = ServerManager.OpenRemote(serverName))
{
var appPools = server.ApplicationPools;
foreach (var appPool in appPools)
{
appPoolList.Add(new AppPoolModel {
Name = appPool.Name,
AutoStart = appPool.AutoStart,
ManagedRuntimeVersion = appPool.ManagedRuntimeVersion
});
}
}
return appPoolList;
}
The remote server uses IIS8 and it son a Windows Server 2012 R2