ApplicationPool.Create Method2

Creates an application pool.

Syntax

oWebAdmin.Get("ApplicationPool").Create(  
   AppPoolName,  
   AutoStart  
)  
var apppool = oWebAdmin.Get("Application").Create(  
   AppPoolName,  
   AutoStart  
);  

Parameters

Name Description
AppPoolName [IN] A string value that specifies the name of the new application pool.
AutoStart [IN] An optional boolean value. true if the World Wide Web Publishing Service (WWW service) will start an application pool automatically either when the application pool is created or when IIS is started; otherwise, false. If you disable automatic startup of an application pool, you must start the application pool manually. Disabling automatic startup is useful when you want to make configuration or content changes to an application in the application pool before the application pool starts.

Return Value

This method does not return a value.

Remarks

The Create method supplants previous methods of creating IIS application pools. To create an application pool in IIS 6.0, you called SpawnInstance_ on the IIsApplicationPoolSetting class, assigned a name to the new application pool, and then called Put_ to save the result to the metabase. Although this procedure will still work in IIS 7, the new Create method performs the same task in one step.

Example

The following example creates a new application pool.

' Connect to the WMI WebAdministration namespace.  
Set oWebAdmin = GetObject("winmgmts:root\WebAdministration")  
  
' Create the new application pool.  
oWebAdmin.Get("ApplicationPool").Create("NewAppPool")  
  

Requirements

Type Description
Client - IIS 7.0 on Windows Vista
- IIS 7.5 on Windows 7
- IIS 8.0 on Windows 8
- IIS 10.0 on Windows 10
Server - IIS 7.0 on Windows Server 2008
- IIS 7.5 on Windows Server 2008 R2
- IIS 8.0 on Windows Server 2012
- IIS 8.5 on Windows Server 2012 R2
- IIS 10.0 on Windows Server 2016
Product - IIS 7.0, IIS 7.5, IIS 8.0, IIS 8.5, IIS 10.0
MOF file WebAdministration.mof

See Also

ApplicationPool Class