Application.RevertToParent Method1

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 - 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

Application Class
ApplicationElementDefaults Class
Site Class