Yesterday I posted about a question that I received in a Windows 7 class here in Yokosuka, Japan. It was how to add an update while servicing an image. Well, because of the technology used, we used the DOS program called DISM. PowerShell V3 running on Windows 8 and up has the DISM module. So to bring things into the modern era, here is how to do the same thing with PowerShell.
First we mount the image.
PS E:\> Get-WindowsImage -ImagePath install.wim | Mount-WindowsImage -Path img -Index 1
The Get-WindowsImage cmdlet will get the Install.wim object. We can then pipe that to Mount-WindowsImage. We need to provide the –Path to the directory that will hold the mounted image and the index number of the image that we want to work with.
Now we can add the package to the image:
PS E:\> Add-WindowsPackage -Path Img -PackagePath Windows6.1-KB976264-v2-x86.msu
Now we can dismount the image and Commit the changes.
PS E:\> Dismount-WindowsImage -Path IMG -Save
Compared to yesterday’s post, the PowerShell way is a lot easier to understand.
Comments