2

What I Want to achive: I want to update a batch of wim-files via a scheduled task. Therfore I mount the wims, add the update-packages and dismount the wims. So far no problem via the dism-module included in PoSh4 on Windowsserver 2012r2.

Problem:

This does not work with wim-files of Windows 10, because the dism-version used via the module is lower (6.3.x) than the necessary version of the wim-image (10.x).

What I tried:

1) Remove the stock dism-module via remove-module dism and import the dism-module via Import-Module 'C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM'. Running Get-WindowsEdition -Online -verbose still delivers dism version 6.3.x

2) Use C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\dism.exe in the script via $env:path or via -f and &. In the fist attempt, dism didnt get the arguments I tried to apply. In the second attempt, dism does not get recognized as a command.

There must be some thing I overlooked, but I cant figure it out.

How does the code need to look like? Args could be e.g.:

$mountpath = 'd:\autoupdating' $package = 'D:\updates\whatever.cab' $dismcommands = "/image:$mountpath /add-package /packagepath:$package

Solution:

PoSh or DISM has heavy problems when getting $dismcommands like I wanted it. DISM does not recognize the string as available commands. You can bypass this easiely by going DISM.exe "/image:$mountpath /add-package /packagepath:$package" which works without a problem. Furthermore you need to modify the $env:Path variable to target C:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM\. I've done this by backing up $env:Path, resetting it and restoring it after I finished working on an WIn10.wim.

restless1987
  • 1,558
  • 10
  • 16

1 Answers1

1

I had to use this code with Windows 8.1 64bit to service Win 10 wim (after installing DISM from the newest ADK of course):

import-module "c:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"

$env:Path = "c:\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\amd64\DISM;$env:Path"

Use in each new session.

anon
  • 11
  • 2