DismApplyUnattend function

Applies an unattended answer file to a Windows image.

Syntax

HRESULT WINAPI DismApplyUnattend(
  _In_ DismSession Session,
  _In_ PCWSTR      UnattendFile,
  _In_ BOOL        SingleSession
);

Parameters

Session [in]
A valid DismSession. The DismSession must be associated with an image. You can associate a session with an image by using the DismOpenSession.

UnattendFile [in]
A relative or absolute path to the answer file that will be applied to the image.

SingleSession [in]
A Boolean value that specifies whether the packages that are listed in an answer file will be processed in a single session or in multiple sessions.

Value Description
TRUE The unattended answer file will be processed in a single session.
FALSE All of the packages that are listed in the answer file will be processed in multiple sessions.

Return value

Returns S_OK on success.

Remarks

When you use DISM to apply an answer file to an image, the unattended settings in the offlineServicing configuration pass are applied to the Windows image. For more information, see Unattended Servicing Command-Line Options.

Example

HRESULT hr = S_OK;
hr = DismApplyUnattend(Session, "C:\test\unattend.xml", TRUE);

Requirements

Requirement Description
Supported host platforms DISM API can be used on any operating system supported by the Windows Assessment and Deployment Kit (Windows ADK). For more information, see the Windows ADK Technical Reference.
Supported image platforms Windows 7, Windows Server 2008 R2, Windows PE 3.0, Windows 8, Windows Server 2012, Windows Preinstallation Environment (Windows PE) 4.0, Windows 8.1, Windows Server 2012 R2, Windows 10, Windows Server 2016
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Header DismAPI.h
Library DismAPI.lib
DLL DismAPI.dll

See also

DismAddDriver

DismAddPackage

DismEnableFeature