共用方式為


IIsComputer.Import (WMI)

The Import method imports a section of an IIS metabase from an export file that has been created on the same IIS server or a different IIS server. The export file does not include machine-specific or system-specific data such as certain paths, GUIDs, passwords, and accounts.

objIIsComputer.Import(
      Passwd,
      FileName,
      SourcePath,
      DestPath,
      MDFlags
)

Parameters

  • Passwd
    [in] Required only when the export file was encrypted when it was created. Specifies the password that was used to encrypt the export file.

  • FileName
    [in] Required. Specifies the path and file name of the XML source file.

  • SourcePath
    [in] Required. Specifies the location in the XML file of the keys being imported. Enter the metabase path as it appears in the XML file. To import all of the keys in the source file, enter the metabase path of the root key.

  • DestPath
    [in] Required. Specifies the metabase path into which the keys are placed. Enter the metabase path as it appears in the XML file. The imported key must be of the type expected in its new position in the metabase path. If the key is not of the expected type, the configuration will not operate properly. For example, do not import the event logging configuration (/LM/Logging) to a Web site configuration path, such as /LM/W3SVC/3. If you specify a path that already exists in the metabase, the imported keys overwrite and replace the keys currently in that metabase path, without warning.

  • MDFlags
    [in] A constant that specifies what inherit and merge flags to set. The constant can be one of the following, defined in the Mddefw.h header file.

    Term

    Value

    Definition

    MD_IMPORT_INHERITED

    0x00000001

    Adds the inherited properties of the exported keys to the export file. Without this flag, the export file does not include properties inherited from higher-level keys. If you use this flag, the Export method adds the inherited properties of the exported keys to an IIsInheritedProperties key in the export file. When you import keys from this file, you can elect to import the inherited properties with the keys.

    MD_IMPORT_NODE_ONLY

    0x00000002

    Prevents the subkeys of the specified key from being added to the export file.

    MD_IMPORT_MERGE

    0x00000004

    Combines keys in the XML file with the existing metabase keys. Without this parameter, the keys in the XML file replace existing keys in the same metabase path. The IMPORT_EXPORT_MERGE flag adds keys to the metabase that appear only in the XML file, retains keys in the metabase that are not in the XML file, and applies the values in the XML file when a key appears in both the XML file and the metabase.

Return Values

This method has no return values.

Requirements

Server: Requires or Windows Server 2003.

Product: IIS

See Also