ApplicationPool.RevertToParent Method [IIS 7 and higher]

Reverts an application pool's configuration value or values to the default.

Syntax

ApplicationPool.RevertToParent(PropertyName)
ApplicationPool.RevertToParent(PropertyName);

Parameters

Name

Description

PropertyName

An optional string value that contains the name of the application pool property that is to be reverted to the default specified by ApplicationPoolElementDefaults Class [IIS 7 and higher]. The property can be nested.

Return Value

This method does not return a value.

Remarks

When you call RevertToParent without parameters, all custom configuration values for the application pool will be removed. If this is not the behavior you want, revert specific properties by using separate parameterized calls to the method.

Example

The following example reverts the AutoStart property of the ContosoAppPool from its current value of false to the default value of true.

' Connect to the WMI WebAdministration namespace.
Set oWebAdmin = GetObject( _
    "winmgmts:root\WebAdministration")

' Get the application pools.
Set oAppPools = oWebAdmin.InstancesOf("ApplicationPool")

' Display the ContosoAppPool AutoStart property.
For Each oAppPool In oAppPools
    If oAppPool.Name = "ContosoAppPool" Then
        WScript.Echo "Application pool name: " & oAppPool.Name
        WScript.Echo "AutoStart mode before revert: " & _
            oAppPool.AutoStart

        ' Revert the AutoStart property.
        oAppPool.RevertToParent("AutoStart")

        ' Refresh the oAppPool object variable.
        oAppPool.Refresh_

        ' Display the changed property.
        WScript.Echo "AutoStart mode after revert: " & _
                oAppPool.AutoStart

        Exit For
    End If
Next

' Output:
' Application pool name: ContosoAppPool
' AutoStart mode before revert: False
' AutoStart mode after revert: True

Requirements

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

See Also

Reference

ApplicationPool Class [IIS 7 and higher]

ApplicationPoolElementDefaults Class [IIS 7 and higher]