Thursday 9 February 2017

If using SysPrep and DISM\IMAGEX to deploy Windows, watch out for this trap!

If you boot to Windows PE and use some sort of script to install Windows OS's to systems using ImageX or DISM, you should check your NTFS Junction points!

So after you have deployed the image and it is booting to Windows nicely, simply drop to an Admin command shell and type  dir /aL

Check your Junctions!

You should see that the Junctions and Symlinks all point to the Windows drive.

If they do not, then you may get some weird problems when installing or running some programs, or with some internal Windows functions.


Typically, this problem is caused by DISM\ImageX and the way it treats reparse points.

If you apply an image to a hard disk volume which does not have the drive letter of C: (e.g. the target volume is U: at the time you are Applying the image using DISM\ImageX), then DISM\ImageX will set all the reparse points to point to U: for you!

The way to avoid this issue, is to use the /norpfix switch.
Another way is to ensure that the target drive letter when using DISM /Apply-Image is always C: (or whatever the drive letter will be when it boots to Windows).

For more information on reparse points see here.
For information on ImageX /norpfix see here.
For information of DISM /NoRpFix see here.

Note that you can both capture using /norpfix and/or apply using /norpfix depending on your requirements.

So go check your imaged systems now!

4 comments:

  1. I just tried to reproduce this with no success. I booted a virtual machine with Windows 10 LTSC 2021 ISO and installed Windows using "Dism /Apply-Image /ApplyDir:U:\". Upon checking after reboot, those junction points are correctly pointing to the C:\ drive.

    ReplyDelete
    Replies
    1. LTSC not supported as it does not contain legacy windows apps

      Delete
    2. Note date of this blog is 2017!

      Delete
    3. I didn't have an earlier version of Windows 10 ISO on hand, so I redid the test with "Windows 8.1 with Update" (released back in 2014), and the result is the same: those junction points are correctly pointed to C:\ drive despite I deliberately assigned the letter U:\ before applying the image with Dism.

      Also, the LTSC version didn't include any "modern" (store) apps, not the other way around.

      Delete