I am trying to create a configuration file to define exclusions for an image capture as described in DISM Configuration List and WimScript.ini Files. The exclusion rules seem to be ignored when I pass my configuration file using the -ConfigFilePath parameter of the New-WindowsImage cmdlet, but I notice they do work when I pass the same configuration file to the equivalent DISM /Capture-Image command. What's going on here?
For example, if I create this directory structure...
Source\Exclude all files\1.dat2.dat3.dat4.dat5.dat
Exclude even files\1.dat2.dat3.dat4.dat5.dat
Exclude no files\1.dat2.dat3.dat4.dat5.dat
...and create this wimscript.ini file...
[ExclusionList]
\Exclude all files\*
\Exclude even files\2.dat
\Exclude even files\4.dat
...then after running this command...
PS> New-WindowsImage -ImagePath 'CapturedByDismModule.wim' -CapturePath 'Source' -Name 'CapturedByDismModule' -ConfigFilePath 'wimscript.ini'
...CapturedByDismModule.wim contains everything under the Source directory. Nothing was excluded.
If, however, I run this command...
PS> Dism.exe /Capture-Image /ImageFile:CapturedByDismExe.wim /CaptureDir:Source /Name:CapturedByDismExe /ConfigFile:wimscript.ini
...then CapturedByDismExe.wim contains this image...
[CapturedByDismExe]Exclude all files\Exclude even files\1.dat3.dat5.dat
Exclude no files\1.dat2.dat3.dat4.dat5.dat
The exclusions worked as expected. So why don't the same parameters passed to New-WindowsImage produce the same image?
Here are the relevant version numbers of my system:
| Component | Version | Command |
|---|---|---|
| Windows 10 | 1809 Build 17763.379 | winver.exe |
Dism.exe |
10.0.17763.1 | [System.Diagnostics.FileVersionInfo]::GetVersionInfo((Get-Command -Name 'Dism.exe').Path).ProductVersion |
| PowerShell | 5.1.17763.316 | $PSVersionTable.PSVersion.ToString() |
| DISM module | 3.0 | (Get-Command -Name 'New-WindowsImage').Module.Version.ToString() |
| DISM module | 10.0.17763.1 | [System.Diagnostics.FileVersionInfo]::GetVersionInfo((Get-Command -Name 'New-WindowsImage').DLL).ProductVersion |