Application.RevertToParent Method [IIS 7 and higher]

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

Syntax

Application.RevertToParent(PropertyName)
Application.RevertToParent(PropertyName);

Parameters

Name

Description

PropertyName

An optional string value that contains the name of the application property that is to be reverted to the default specified by the ApplicationElementDefaults class that is exposed as the ApplicationDefaults property on the parent Site class. The property to revert can be nested (for example, "VirtualDirectoryDefaults.PhysicalPath").

Return Value

This method does not return a value.

Remarks

When you call RevertToParent without parameters, all settings for the application that are in the ApplicationHost.config file 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 name of the default Web site's MyApp application pool from "MyAppPool" to "DefaultAppPool".

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

' Retrieve the MyApp application from the default Web site.
Set oApp = oWebAdmin.Get( _
    "Application.SiteName='Default Web Site',Path='/MyApp'")

' Display the site name, path, and application pool.
WScript.Echo "Web site name: " & oApp.SiteName
WScript.Echo "Application path: " & oApp.Path    
Wscript.Echo "ApplicationPool: " & oApp.ApplicationPool

' Revert the MyApp application pool to the application pool
' specified by the parent site's ApplicationDefaults property.
oApp.RevertToParent("ApplicationPool")

' Update the contents of the application object variable.
oApp.Refresh_

' Display the change.
Wscript.Echo "ApplicationPool after revert: " & _
    oApp.ApplicationPool

' Example output:
' Web site name: Default Web Site
' Application path: /MyApp
' ApplicationPool: MyAppPool
' ApplicationPool after revert: DefaultAppPool

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

Application Class [IIS 7 and higher]

ApplicationElementDefaults Class [IIS 7 and higher]

Site Class [IIS 7 and higher]