0

I have a freshly installed Windows 11 that isn't experiencing any errors or problems. All of my applications are working just fine.

I would like to move this installation to a different hard disk. For example, I bought a new, better SSD. I want to copy my system completely.

I found on the internet that there is a tool called DISM. It can help me with this task in three steps:

  1. Create a WIM image of the original partition
  2. Apply this image to the new drive
  3. Create EFI partition

I've found this guide. It completely describes these steps:

What is the most efficient, native way to image a Windows partition?

So I booted to the Windows installation DVD. Pressed Shift+F10.

Captured my old system with this command:

mkdir "D:\Temp"
Dism /Capture-Image /ImageFile:"D:\Base.wim" /CaptureDir:"C:" /Name:"Windows Backup" /Compress:Fast /ScratchDir:"D:\Temp" /EA /CheckIntegrity /Verify /NoRpFix

All drive letters are correct. I checked them because they're different after the reboot.

As far as the last four options go, they don't seem to matter!

Junction points are correct anyway https://rmprepusb.blogspot.com/2017/02/if-using-sysprep-and-dismimagex-to.html

I tried capturing and applying the image several times, adding a new options, with formatting the new drive. I still had the same problem.

The next step is disconnecting the old drive. Then rebooted to the installation DVD again.

I did this partitioning on my new drive:

diskpart
lis dis
clean
convert gpt
cre par efi size=500
for fs=fat32 quick
cre par pri
for fs=ntfs quick

Applying the new image file:

mkdir "C:\Temp
Dism /Apply Image /ImageFile:"G:\Base.wim" /Index:1 /ApplyDir:"C:" /ScratchDir:"C:\Temp" /EA /CheckIntegrity /Verify /NoRpFix

Creating an EFI partition

cd /d E:
mountvol Z: /s
BcdBoot C:\Windows /s Z: /f UEFI

The new system is booting correctly, but when I try to start most of the uwp applications (Snipping Tool, Terminal, Notepad, etc), it just says "This app can't open" like this.

Enter description of image here

And the funniest thing of all is that when I try to launch this application for the second time, it actually works! Windows somehow repairs itself, even without access to the internet.

However, this doesn't work for all apps; in some cases, it will open Microsoft Store, where you'll see the Reinstall button. Alternatively, a manual click on Repair in the app's settings will also do the trick.

Also, if the original system didn't have any sfc errors, the new one has a lot of them. Here is a log of the sfc /scannow https://gist.github.com/megapro17/8e025130eb2e2d670ad79d4ab1d550af

What am I doing wrong? Why does my system have errors after the restore?

megapro17
  • 113
  • 5
  • 1
    “Why does my system have errors after the restore?” - The systems WinSxS is corrupt based on the errors. You can probably mount the .WIM within Windows, and point DISM to that as the source, and run the appropriate DISM command to repair the corruption. – Ramhound Mar 27 '23 at 23:19
  • @Ramhound yeah i something like `Dism /Online /Cleanup-Image /RestoreHealth /StartComponentCleanup` does work. but i anyway want to know how to restore image without errors – megapro17 Mar 28 '23 at 16:08
  • Try running /Cleanup-Image before you make the image. Saw a lot of messages in the logs about supercseeded patches. – Ramhound Mar 28 '23 at 17:16
  • Wow, this is so stupid. I never thought my freshly installed windows will have errors out of the box! But it doesn't matter, Even if i create image after i ran cleanup-image, i still have 'this app can't open' error. Sfc and cleanup fine this time tho. Dism is broken? – megapro17 Mar 29 '23 at 21:01
  • That it is very unlikely. Just to clarify once you run `Dism /Online /Cleanup-Image /RestoreHealth /StartComponentCleanup` the issues with the image is resolved? – Ramhound Mar 29 '23 at 21:12
  • Yes, I made sure that there's no errors at all, I ran restorehealth and sfc a few times, and it always said `No component store corruption detected` and `windows resource protection did not find any integrity violations`. Only after that I captured and applied image, and i got the same result with `This app can't open`. But now restorehealth and sfc found no new problems – megapro17 Mar 29 '23 at 22:30
  • If you take an image of that installation and apply it to the partition do you then get the same behavior? Promise there is a reason for that request – Ramhound Mar 29 '23 at 22:42
  • Do not quite understand? The error appears only after applying the image to the other partition, on the fresh drive – megapro17 Mar 29 '23 at 23:59

1 Answers1

0

OP's issue may be related to /EA (capturing extended attributes), not the answer the OP linked to - that answer is correct and is how system images are captured and applied everyday by businesses, universities, power users, etc. (it's also how Windows itself is installed).

  • The answer the OP linked to contains the man page link for /capture-image - was it reviewed?

If the purpose of capturing extended attributes was for user files, generally the USMT (User State Migration Tool) is used, which is what is recommended by Microsoft (extended attributes appear to only be for .cab files and certain variables when using a LTI/ZTI). AFAIK, extended attributes should not be captured when capturing/applying system image WIMs and I've never come across someone doing so on StackExchange or Spiceworks. The man page isn't clear on what use case /EA should be used, only:

Captures extended attributes. The switch must be explicitly specified to capture extended attributes. DISM will capture extended attribute bits if they are set in the components to be captured in the WIM image. If the bits are not set, DISM won't set them. Only the inbox components of CAB packages and drivers will have these extended attribute bits, not the AppX package components or Win32 application components. Extended attributes with prefix “$Kernel.” in name will be skipped because only user mode extended attributes are captured. If you use DISM in Windows 10, version 1607 to capture extended attributes and use an earlier version of DISM to apply the image, the operation will succeed but the extended attributes will not be set to the applied image.

Re-capturing without /EA should resolve the issue.

zoomzoom
  • 1
  • 2
  • it doesn't make any difference, i tried without /EA a few times – megapro17 Apr 05 '23 at 00:13
  • @megapro17 There's something else going on, as the `/capture-image` command isn't likely the issue. If it was, there'd be multiple bug reports filed with Microsoft since `/capture-image` and `/apply-image` are the backbone of deploying Windows and is also how Windows is installed via the installer. It may be worth your time to file a big report, but it doesn't seem likely the command is the issue. – zoomzoom Apr 05 '23 at 02:21
  • @megapro17 To verify, are you using the `dism` program that came with the OS or a standalone version? Is the bootable Windows install ISO for the version of Windows 11 you installed? (Problems can occur if the WIM was captured with a newer `dism` version than the one used to apply the image.) Is the freshly installed Windows 11 the most recent version available via the media creation tool? This is such a rare issue and it may not be worth the time to troubleshoot for you. You can clone the old disk to the new disk, but you'll likely need to manually resize partitions on the new disk afterward – zoomzoom Apr 05 '23 at 12:02
  • I booted from the installation DVD, opened the command prompt and did all the operations. I used the same version of DISM to capture and apply the image that came with the installation DVD. System also was installed from it. It's actually newer than the media creation tool, it's the latest original msdn image `Microsoft Windows 11 [10.0.22621.1413], Version 22H2 (Updated March 2023)`. If this is a rare problem, try doing the same thing in your virtual machine, it won't take long. Ideally, record everything, I can show full process too. I'm sure you'll get the same errors. – megapro17 Apr 07 '23 at 22:48
  • @megapro17 If you're able to replicate the same issue on a fresh clean install inside a VM, file a bug report with Microsoft, as that would be a critical bug since `dism` is the backbone of installing, managing, and and deploying Windows. It's extremely rare for an issue to occur with `dism` itself due to how critical it is to Windows. – zoomzoom Apr 12 '23 at 14:07