ConfigurationHistorySection クラス

ApplicationHost ヘルパー サービスの構成履歴設定を構成します。

構文

class ConfigurationHistorySection : ConfigurationSection  

メソッド

次の表に、ConfigurationHistorySection クラスによって公開されるメソッドの一覧を示します。

名前 説明
GetAllowDefinition (ConfigurationSection から継承。)
GetAllowLocation (ConfigurationSection から継承。)
RevertToParent (ConfigurationSection から継承。)
SetAllowDefinition (ConfigurationSection から継承。)
SetAllowLocation (ConfigurationSection から継承。)

プロパティ

次の表は、ConfigurationHistorySection クラスによって公開されるプロパティの一覧です。

名前 説明
Enabled 読み取り/書き込みの boolean 値。 ApplicationHost ヘルパー サービスが、Period プロパティで指定された期間を使用して ApplicationHost.config ファイル内の変更をチェックする場合は true。サービスが変更をチェックしない場合は false。 既定値は、true です。 構成が変更されても有効な場合、ヘルパー サービスは ApplicationHost.config ファイルを、HistoryPath プロパティで指定されたディレクトリ内のバージョン管理されたサブディレクトリに保存します。
HistoryPath 構成履歴サブディレクトリを含むディレクトリのパスを指定する読み取り/書き込みの string 値。 既定値は "%systemdrive%\inetpub\history" です。 注: ApplicationHost ヘルパー サービスは、構成履歴サブディレクトリごとに ApplicationHost.config ファイルのコピーを 1 つ保存します。 構成履歴サブディレクトリの名前付け形式は、CFGHISTORY_<serial number> です。 serial number は、10 桁の順次番号 (ゼロ埋め込み) です。
Location (ConfigurationSection から継承。)キー プロパティ。
MaxHistories 構成履歴サブディレクトリの最大数を指定する読み取り/書き込みの uint32 値。 既定値は 10 です。 構成履歴サブディレクトリの数が指定した数に達すると、バージョン番号が最も小さいサブディレクトリが削除されます。
Path (ConfigurationSection から継承。)キー プロパティ。
Period ApplicationHost.config ファイルの変更について ApplicationHost ヘルパー サービスがチェックする頻度を指定する読み取り/書き込みの datetime 値。 既定値は 2 分です。 構成が変更されても有効な場合、ヘルパー サービスは、HistoryPath プロパティで指定されたディレクトリにファイルを保存します。
SectionInformation (ConfigurationSection から継承。)

サブクラス

このクラスにはサブクラスが含まれていません。

解説

このクラスには、現在の状態が望ましくなくなった場合に以前の構成状態に復元する構成履歴機能が用意されています。

ApplicationHost ヘルパー サービスは、Period プロパティで指定された設定間隔で別個の構成履歴サブディレクトリに ApplicationHost.config ファイルを保存することで、構成履歴機能を有効にします。 サブディレクトリは、HistoryPath プロパティで指定されたディレクトリに存在します。

ApplicationHost.config ファイルを変更するときに間違った場合は、以前のバージョンを %windir%\system32\inetsrv\config ディレクトリにコピーすることで、構成履歴サブディレクトリから以前のバージョンのファイルを復元できます。

Note

構成履歴ファイルには、個別のアクセス制御リスト (ACL) 構成は必要ありません。 管理者のみがアクセスできる親ディレクトリから ACL 値を継承します。

構成履歴機能は、ApplicationHost ヘルパー サービスによって異なります。 ApplicationHost ヘルパー サービスはランタイムに依存しないサービスであり、その動作には Windows プロセス アクティブ化サービス (WAS) や World Wide Web 発行サービス (WWW サービス) は必要はありません。 他のサービスに依存せず、スタートアップの種類は Automatic です。

Note

ApplicationHost ヘルパー サービスが停止している場合、構成履歴機能は機能しません。

次のコード例では、履歴サブディレクトリの最大数を 20 に設定し、変更がないか ApplicationHost.config ファイルを 4 分ごとにチェックするように指定します。 ヘルパー関数を使って、変更の前後の ConfigurationHistorySection 値を表示します。

' 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

要件

説明
クライアント - Windows Vista 上の IIS 7.0
- Windows 7 上の IIS 7.5
- Windows 8 上の IIS 8.0
- Windows 10 上の IIS 10.0
[サーバー] - Windows Server 2008 上の IIS 7.0
- Windows Server 2008 R2 上の IIS 7.5
- Windows Server 2012 上の IIS 8.0
- Windows Server 2012 R2 上の IIS 8.5
- Windows Server 2016 上の IIS 10.0
Product - IIS 7.0、IIS 7.5、IIS 8.0、IIS 8.5、IIS 10.0
MOF ファイル WebAdministration.mof

参照

ConfigurationSection クラス