The Component Platform Interface (CPI) provides a programmatic interface to build and maintain Windows unattended answer files. CPI is the foundation on which Windows System Image Manager (Windows SIM) is built. Both the API and the user interface enable the same scenarios.

You can use the CPI API to edit existing Windows unattended setup answer files and configurations to suit your needs. These changes can include adding security fixes, changing drivers, adding newly introduced productivity applications, and updating productivity applications.

The Main Objects

The following table lists the CPI main classes and members along with the definition and usage for each.

CPI Class

Commonly Used Members Definition and Usage

CreateAnswerFile()

Instance

OpenOfflineImage()

OpenPackage()

OpenAnswerFile()

The root object. Used to create the top-level object in the system.

OfflineImage Class

Commonly Used Members Definition and Usage

Name

Path

Packages

ComponentSettings

Represents an image. Contains packages installed in the image, as well as available settings and settings overrides for each component in the image (through the ComponentSettings collection).

Answer File Class

Commonly Used Members Definition and Usage

Path

Dirty

DocumentState

OfflineImage

PackageActions

ComponentSettings

AddPackageAction()

Publish()

Save()

SaveAs()

Validate()

Represents the answer file (Unattend.xml). Use Cpi.OpenAnswerFile to open an existing one and Cpi.CreateAnswerFile() to create a new one. The answer file contains a collection of PackageActions and SettingOverrides (through the ComponentSettings collection).

Use AnswerFile.Save() or SaveAs() to save an answer file. Note that CPI maintains and optimizes any conflicting actions while loading an answer file.

Package Class

Commonly Used Members Definition and Usage

Id

PackageType

DisplayName

Description

CompanyName

ProductName

IsRemovable

KeyWord

Path

Load()

Represents both the installed package in an image and the package file (.cab file) released by Microsoft. When you create an image object, the Packages collection is populated with packages installed in the image.

To create a package object that represents a package file, use Cpi.OpenPackage().

PackageType property returns the type of the package (Hotfix, Windows Service Pack).

Package Action Class

Commonly Used Members Definition and Usage

PackageActionType

PermanenceType

AnswerFile

SourcePaths

WindowsFeatureSelections

AddSourcePath()

AddWindowsFeatureSelection()

Represents the package action (install, remove, or configure) in the answer file. If the action is to configure a package, use the WindowsFeatureSelection object to enable or disable a Windows feature.

ComponentSetting Class

Commonly Used Members Definition and Usage

ComponentId

OfflineImage

SettingDefinitions

SettingOverrides

Represents available settings of a component (through SettingDefinitions) and setting override values.

SettingDefinition Class

Commonly Used Members Definition and Usage

ApplicableConfigurationPasses

Name

Path

DataType

EnumerationValue

SettingsDefinitions

Describes a setting schema. Contains default values, enumeration, and pattern restrictions.

SettingOverrides Class

Commonly Used Members Definition and Usage

Value

StringArrayValue

Definition

AppliedConfigurationPasses

SettingOverrides

If the settings are from an image, represents overridden values in the image. If the settings are from an answer file, represents values that users want to override when the answer file is applied to an image.

The following diagram shows the organization of the main classes and members for the CPI API.

CPI Object Model

CPI Interfaces and Architecture

The following diagram shows the CPI interfaces and architecture.

Windows System Image Manager Architecture

See Also