Export (0) Print
Expand All
Expand Minimize

ConfigurationHistorySection Class [IIS 7 and higher]

IIS 7.0

Configures the configuration history settings of the ApplicationHost Helper Service.

class ConfigurationHistorySection : ConfigurationSection

The following table lists the methods exposed by the ConfigurationHistorySection class.

Name

Description

GetAllowDefinition

(Inherited from ConfigurationSection.)

GetAllowLocation

(Inherited from ConfigurationSection.)

RevertToParent

(Inherited from ConfigurationSection.)

SetAllowDefinition

(Inherited from ConfigurationSection.)

SetAllowLocation

(Inherited from ConfigurationSection.)

The following table lists the properties exposed by the ConfigurationHistorySection class.

Name

Description

Enabled

A read/write boolean value. true if the ApplicationHost Helper Service checks for changes in the ApplicationHost.config file by using the time interval specified by the Period property; false if the service does not check for changes. The default is true. If the configuration changes and is still valid, the helper service saves the ApplicationHost.config file in a versioned subdirectory inside the directory specified by the HistoryPath property.

HistoryPath

A read/write string value that specifies the path of the directory that contains the configuration history subdirectories. The default is "%systemdrive%\inetpub\history".

NoteNote:
The ApplicationHost Helper Service saves one copy of the ApplicationHost.config file in each configuration history subdirectory. The configuration history subdirectories have the naming format CFGHISTORY_<serial number>. The serial number is a 10-digit sequential number (zero padded).

Location

(Inherited from ConfigurationSection.) A key property.

MaxHistories

A read/write uint32 value that specifies the maximum number of configuration history subdirectories. The default is 10. If the number of configuration history subdirectories reaches the number specified, the subdirectory with the lowest version number is deleted.

Path

(Inherited from ConfigurationSection.) A key property.

Period

A read/write datetime value that specifies the frequency with which the ApplicationHost Helper Service checks for changes in the ApplicationHost.config file. The default is 2 minutes. If the configuration changes and is still valid, the helper service saves the files in the directory specified by the HistoryPath property.

SectionInformation

(Inherited from ConfigurationSection.)

This class contains no subclasses.

This class provides a configuration history feature that enables you to go back to a former configuration state if you no longer want the current state.

The ApplicationHost Helper Service enables the configuration history functionality by saving the ApplicationHost.config file to separate configuration history subdirectories at set intervals specified by the Period property. The subdirectories reside in the directory specified by the HistoryPath property.

If you make a mistake when you modify the ApplicationHost.config file, you can restore an earlier version of the file from a configuration history subdirectory by copying the earlier version into the %windir%\system32\inetsrv\config directory.

NoteNote:

The configuration history files do not require separate access control list (ACL) configuration. They inherit their ACL values from the parent directory, to which only administrators have access.

The configuration history feature depends on the ApplicationHost Helper Service. The ApplicationHost Helper Service is a runtime-independent service that does not require the Windows Process Activation Service (WAS) or the World Wide Web Publishing Service (WWW service) to operate. It does not depend on any other service and its startup type is Automatic.

NoteNote:

If the ApplicationHost Helper Service is stopped, the configuration history feature will not work.

The following code example sets the maxiumum number of history subdirectories to 20 and specifies that the ApplicationHost.config file be checked for changes every 4 minutes. A helper function displays the ConfigurationHistorySection values before and after the change.

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

' Get the configuration history section.
Set oSection = oWebAdmin.Get( _
    "ConfigurationHistorySection.Path=" & _
    "'MACHINE/WEBROOT/APPHOST',Location=''")

' Display the class name of the section.
WScript.Echo "[ " & oSection.Path_.Class & " ]" & vbCrLf

' Display the initial settings.
Call DisplaySettings("Initial Values", oSection)

' Set the maximum number of history subdirectories to 20.
oSection.MaxHistories = 20

' Check ApplicationHost.config for changes every 4 minutes.
oSection.Period = "00000000000400.000000:000"

' Save the values to configuration.
oSection.Put_

' Refresh the oSection object variable with the new values.
oSection.Refresh_

' Show the changed settings.
Call DisplaySettings("New Values", oSection)

' ==== DisplaySettings helper function. ====
Function DisplaySettings(HeadingText, oSection)

    ' Display a heading.
    WScript.Echo String(Len(HeadingText), "-")
    WScript.Echo HeadingText
    WScript.Echo String(Len(HeadingText), "-")

    ' Display configuration history section properties.
    WScript.Echo "Path: " & oSection.Path
    WScript.Echo "Location: " & oSection.Location
    WScript.Echo "History Path: " & oSection.HistoryPath
    WScript.Echo "Period: " & oSection.Period
    WScript.Echo "MaxHistories: " & oSection.MaxHistories
    WScript.Echo
End Function

ConfigurationSection

   ConfigurationHistorySection

Type

Description

Client

Requires IIS 7 on Windows Vista.

Server

Requires IIS 7 on Windows Server 2008.

Product

IIS 7

MOF file

WebAdministration.mof

Community Additions

ADD
Show:
© 2014 Microsoft