DismCommand.Builder
public class DismCommand.Builder :
CliWrapCommandBase<CommandResult>.BuilderBase<DismCommand, DismCommand.Builder>
1. Constructors
1.1. Builder()
public Builder()
2. Properties
2.1. ArgumentSuffix
protected override string ArgumentSuffix { get; }
2.2. LongArgumentPrefix
protected override string LongArgumentPrefix { get; }
2.3. SingleCharacterArgumentPrefix
protected override string SingleCharacterArgumentPrefix { get; }
3. Methods
3.1. AddDriver(string, string, bool, bool)
Stages a boot-critical driver into an OFFLINE Windows image via /Add-Driver so it is present the first time the applied OS boots. Needed for storage drivers the inbox image lacks (e.g. VirtIO vioscsi on Proxmox virtio-scsi); without it Windows cannot reach its own system disk at boot → INACCESSIBLE_BOOT_DEVICE (0x7B) reboot loop.
public DismCommand.Builder AddDriver(string imagePath, string driverPath, bool recurse = true, bool forceUnsigned = true)
| Name | Type | Description |
|---|---|---|
imagePath |
string |
Root of the APPLIED offline Windows install (e.g. "W:\" with W:\Windows present) - NOT the running WinPE. |
driverPath |
string |
Folder (searched recursively when recurse is set) or a single .inf to add. |
recurse |
bool |
Recurse into subfolders when driverPath is a directory. |
forceUnsigned |
bool |
Also stage unsigned/test-signed driver packages (/ForceUnsigned). |
Returns: DismCommand.Builder
3.2. ApplyImage(string, string, string)
Applies a WIM image to a target directory.
public DismCommand.Builder ApplyImage(string wimFile, string imageName, string applyDir)
| Name | Type | Description |
|---|---|---|
wimFile |
string |
Path to the WIM file. |
imageName |
string |
Name of the image within the WIM (e.g. "Windows 11 Pro"). |
applyDir |
string |
Target directory to apply the image to (e.g. "W:\"). |
Returns: DismCommand.Builder
3.3. Build()
public override DismCommand Build()
Returns: DismCommand
3.4. BuildInternal(CliWrap.Command)
protected override DismCommand BuildInternal(CliWrap.Command cliCommand)
| Name | Type | Description |
|---|---|---|
cliCommand |
CliWrap.Command |
Returns: DismCommand
3.5. ExportDriverOffline(string, string)
Exports all 3rd-party drivers from an offline Windows install to a destination folder. Use from WinPE to grab drivers off a freshly-flashed laptop before wiping it.
public DismCommand.Builder ExportDriverOffline(string imagePath, string destination)
| Name | Type | Description |
|---|---|---|
imagePath |
string |
Root of the offline Windows install (e.g. "W:\" with W:\Windows present). |
destination |
string |
Output folder. DISM creates one subfolder per driver package. |
Returns: DismCommand.Builder
3.6. GetWimInfo(string)
Gets information about a WIM file.
public DismCommand.Builder GetWimInfo(string wimFile)
| Name | Type | Description |
|---|---|---|
wimFile |
string |
Returns: DismCommand.Builder
3.7. GetWimInfo(string, int)
Gets information about a specific image index in a WIM file.
public DismCommand.Builder GetWimInfo(string wimFile, int index)
| Name | Type | Description |
|---|---|---|
wimFile |
string |
|
index |
int |
Returns: DismCommand.Builder
3.8. ScratchDir(string)
Sets the DISM scratch directory (/ScratchDir). Default scratch lives on the WinPE RAM disk (X:), which can be too small for /Apply-Image → "insufficient storage".
public DismCommand.Builder ScratchDir(string scratchDir)
| Name | Type | Description |
|---|---|---|
scratchDir |
string |
Existing directory on a disk with enough free space (e.g. "D:\NETSetup\scratch"). |
Returns: DismCommand.Builder