I use the following code to create a app pool:
var metabasePath = string.Format(@\"IIS://{0}/W3SVC/AppPools\", serverName); DirectoryEntry newpool; DirectoryEntr
newpool.Properties["ManagedRuntimeVersion"].Value = "v4.0";
Will do the same thing as the Microsoft.Web.Administration.dll but using DirectoryEntry
Also
newPool.InvokeSet("ManagedPipelineMode", new object[] { 0 });
Will switch to integrated or classic pipeline mode using DirectoryEntry.