Vista Package Manager is command line tool to install, remove or updates Windows packages to an offline Windows image.  Used incorrectly you can easily corrupt your Windows installation image.  Here are some tips to avoid this problem.

The first and most important tip is always save your previous images.  You can not repair a corrupt image so you may need to go back to your most recent working image.

 Below is a typical batch file I would use to install multple hotfixes to an offline image when booting from  WinPE.

wpeutil CreatePageFile /path=c:\pagefile.sys

md c:\sandbox
Start /w \servicing\pkgmgr.exe /o:"C:\;C:\windows" /ip /m:c:\hotfixes\Windows6.0-KB9999-x86.cab /s:C:\sandbox /L:C:\WINDOWS\fixes.LOG
echo %errorlevel%

rd c:\sandbox /s /q
md c:\sandbox

Start /w  \servicing\pkgmgr.exe /o:"C:\;C:\windows" /ip /m:c:\hotfixes\KB8888-x86.cab /s:C:\sandbox
/L:C:\WINDOWS\fixes.LOG
echo %errorlevel% 

Once you have correct syntax for Pack Manager related to file name and path locations the above method avoids other types of common errors. Below are the details related to the above commands.

wpeutil CreatePageFile /path=c:\pagefile.sys

I create a pagefile on the local drive so pkgmgr doesn't run out of memory since WinPE now boots to a RAM disk.

rd c:\sandbox 
md c:\sandbox

Pack Manager needs an empty sandbox for each fix or package. You can use multiple sandboxes or empty the current t one.

Start /w \servicing\pkgmgr.exe /o:"C:\;C:\windows" /ip /m:c:\hotfixes\Windows6.0-KB9999-x86.cab /s:C:\sandbox /L:C:\WINDOWS\fixes.LOG

You can create an xml file with multiple fixes but Package Mangers may run out of scratch space before you finish. The number of fixes before failure is going to depend on your system configuration and size of the fixes. I recommend install them one at a time in a batch file.

echo %errorlevel%

This returns the error code from Package Manager.  Verify it is 0 (no error) as the first step to check if Pack Manger worked correctly. In addition you will need to verify the log file ends without error.  The log file is in several formats but in this case since I use /l:c:\windows\fixes.log the one you want to look at is c:\windows\fixes.log.txt.

Be sure the log is complete for each fix  It should contain something similar to as the last lines.

2009-05-27 15:25:31, Info                  CBS    Pkgmgr: return code: 0x0
2009-05-27 15:25:33, Info                  CBS    Pkgmgr: return code: 0x0

If the log just stops without this information, even if the previous errorlevel was 0 your image is likely to be corrupt. You will need to re-run your scripts with your original image after you verify the following:

You scripts have a clean sandbox for each fix.

You don't have other applications running.

You don't have hotfixes with order dependencies that you have not accounted for.

Linda