Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

ConfigurationSection.RevertToParent Method [IIS 7 and higher]

IIS 7.0

Reverts configuration values in a section to their defaults.

ConfigurationSection.RevertToParent();
ConfigurationSection.RevertToParent(PropertyName);
ConfigurationSection.RevertToParent
ConfigurationSection.RevertToParent(PropertyName)

Name

Definition

PropertyName

An optional string value that contains the name of a property in the configuration section. The property can be nested (for example, oLogSection.RevertToParent("CentralBinaryLogFile.Directory").

This method does not return a value.

This method provides a way to delete configuration values that have been written to a configuration file.

The following example shows two ways of using the RevertToParent method:

  1. The first part reverts a specified property to the default value. The following line from the example reverts the Enabled property of DefaultDocumentSection of the default Web site by specifying the property name as a RevertToParent parameter.

    oDefaultDocumentSection.RevertToParent("Enabled")
    

    This removes the value of false, which was specified in the Web.config file of the default Web site, and replaces it with the default value of true.

  2. The second part reverts an entire section to the default values. The following line from the example reverts the entire DefaultDocumentSection contents of the default Web site by specifying no parameters for RevertToParent.

    oDefaultDocumentSection.RevertToParent
    

    This removes all values from the default document section in the Web.config file of the default Web site. The default values of the default Web site replace the removed values.

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

' Get the DefaultDocumentSection for the Default Web Site.
Set oSite=oWebAdmin.Get("Site.Name='Default Web Site'")
oSite.GetSection "DefaultDocumentSection", oDefaultDocumentSection

' 1. Revert the Enabled property to its default value.
oDefaultDocumentSection.RevertToParent("Enabled")

' 2. Revert the entire default document section.
oDefaultDocumentSection.RevertToParent

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.