Inject PowerShell in to your offline Vista image

The Windows Automated Installation Kit includes pkgmgr.exe to inject packages and drivers to offline images.  "Packages" loosely means the updates that Microsoft releases, usually through Windows Update.  I believe there are partner initiatives underway to deliver 3rd party packages as well.  Technically the tool works with updates you download from Microsoft as .MSU files and contain .CAB files which can be extracted and applied.

Now for testing, this presented me with an issue because there aren't exactly a lot of hotfixes available for Vista to test with.  I looked in Windows Update history and searched the KB for the first in the list.

I had installed PowerShell earlier that day after downloading the install as a stand-alone .MSU.  I thought to myself, "Wait a minute, I think I just stumbled upon a very interesting possibility...  PowerShell is a Microsoft package, I wonder if you could inject it to an offline WIM?"  I fired up my BDD server and mounted a WIM of Vista Enterprise.  A few minutes later I had the answer file ready to go and set pkgmgr to inject my first ever offline update - PowerShell!  Here's the instructions, you can also find this in the WAIK user's guide:

Expand your update file

Per support article 928636 you no longer execute the file with a command line extension to extract the files.  Vista contains a tool for this function.  Simply run expand.exe with the proper statements as seen below.


Now that you it extracted, copy the .cab file in to your distribution share so you can create an answer file in SIM.


Finally, mount the WIM image and run pkgmgr to inject the image.


That's all you should expect to see as feedback at the command line.  Check your log folder for information.


2007-02-08 09:21:00, Info CBS Pkgmgr: Completed unattend install: Microsoft-Windows-PowerShell-Package-TopLevel~31bf3856ad364e35~x86~~6.0.6000.16386, hr: 0x0


2007-02-08 09:21:00, Info CBS Exec: Processing complete. Session: 3808:25980668, Package: Microsoft-Windows-PowerShell-Package-TopLevel~31bf3856ad364e35~x86~~6.0.6000.16386, hr: 0x0
2007-02-08 09:21:00, Info CBS Session: 3808:25980668 finalized. Reboot required: no
2007-02-08 09:21:00, Info CBS Pkgmgr: return code: 0x0

Now just unmount the WIM, don't forget to /commit!

Finally, your end result.  A freshly deployed install with PowerShell already installed!

Comments (3)

  1. Anonymous says:

    Below Michael Greene describes how to inject PowerShell using the new WAIK tools. Great work Michael!

  2. //o// says:


    PowerShell where it should be 😉

    Greetings //o//

  3. Himanshu says:

    Great Tip!

Skip to main content