Encapsulates answer file actions required for Windows Setup to install out-of-box device drivers. Namespace: Microsoft.ComponentStudio.ComponentPlatformInterface
Assembly: Microsoft.ComponentStudio.ComponentPlatformInterface (in microsoft.componentstudio.componentplatforminterface.dll)


Visual Basic
Dim driverPath1 As DriverPath


Visual Basic
Public Class DriverPath
		Inherits AnswerFileSettingOverride
public class DriverPath : AnswerFileSettingOverride
public ref class DriverPath : AnswerFileSettingOverride
public class DriverPath extends AnswerFileSettingOverride
public class DriverPath extends AnswerFileSettingOverride


The following example demonstrates how to add a driver to the answer file.

To run this example, you must change the value of the variable wimPath to match the path that contains the .wim file on your computer. You also must change the value of the variable ansFile to the name of an answer file on your computer.
// DriverPath.cs

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ComponentStudio.ComponentPlatformInterface;

namespace MyDriverNameSpace
	public class MyDriverClass
		static void Main()
			MyDriverClass mDC = new MyDriverClass();
				"The driver is added to the answer file.");

		public void HowToAddDriverPath()
			// Declare the answer file path: 
			string ansFile =
			 @"C:\myWorkingFolder\My Unattend1.xml";

			// Declare the .wim file path:
			string wimPath = @"C:\myWorkingFolder\install.wim";

			DriverPath nvidiaPath;
			AnswerFile unattend;

			// Create a Cpi instance:
			Cpi n = Cpi.Instance;
			// Check if the catalog file is created, if not create one:
			WimInfo wInfo = n.OpenWim(wimPath);

			if (!wInfo.Images[0].ValidateCatalog().Succeeded)

			// Open the offline image:
			OfflineImage image = n.OpenOfflineImage(wInfo.Images[0]);

			// Create the answer file:
			unattend = Cpi.Instance.CreateAnswerFile(image);

			// Add a driver action to add nvidia driver:
			DriverPathCollection driverCollection =
			nvidiaPath = driverCollection.Create(

			// Optional: add credential to access the driver:
			nvidiaPath.DynamicKey = "nvidia1";
			nvidiaPath.Domain = "domain1";
			nvidiaPath.UserName = "user1";
			nvidiaPath.Password = "password1";

			// Save the answer file:
/* Output:
The driver is added to the answer file.


Out-of-box device drivers are installed by overriding certain settings of the Microsoft-Windows-PnpCustomizationWinPE and Microsoft-Windows-PnpCustomizationNonWinPE components. If these settings overrides are specified properly in answer file, the appropriate Windows component will perform the actual installation during Windows Setup.

This class encapsulates all the details needed for installing out-of-box device driver components in a specific configuration pass.

When creating settings overrides in an answer file for an out-of-box device driver installation, you must specify the location of the out-of-box device driver (.inf file), the configuration pass to which the setting will be applied, and the user credentials used to access the location if the driver is available on a network share.

You can use Create to create settings overrides in an answer file for out-of-box device driver installation. You can use GetDriverPaths to get the instance of DriverPathCollection from the answer file.

Inheritance Hierarchy


Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Development Platforms

Windows XP Home Edition, Windows XP Professional, Windows Server 2003, Windows Vista, and Windows 2000

Target Platforms

See Also