Where is Winre.wim going?

Comments, questions, bug reports, etc.
Post Reply
whiggs
Posts: 3
Joined: Mon Jan 16, 2017 12:04 am

Where is Winre.wim going?

Post by whiggs »

To whom this may concern,
Before I discovered your very cool and very useful wim manipulation library, I was only using Microsoft deployment tools. I had created a system by which all partitioning, operating system install, and configuration was done automatically via scripting. However, recently, I have started using wimlib for all of my wim manipulation and application needs, and only use microsoft deployment tools when I need to mount the image for offline servicing (BTW, why is mounting not supported in Windows? Makes it kind of inconvenient to have to navigate back and forth between DISM and wimlib when trying to mount and service offline images). However, ever since I started doing this, I have run into a slight hiccup in my scripting process. Part of my operating system installation process is, after the image has been applied to the partition, it copies the windows recover environment wim file (C:\windows\system32\Recovery\winre.wim) to a separate recovery partition that was created during the hard drive partitioning. However, when the script gets to this part, (and I am not sure, unfortunately, if this is only with wim files that are CREATED using wimlib or if it is any image that is APPLIED using wimlib), the Windows recovery environment wim file is missing from the applied operating system, so I have to extract the folder from a base install wim I pulled out of a operating system iso, apply the appropriate attributes to the file, then copy it to the recovery partition, and then activate it. This is really disrupting the "automation" aspect of my automated operating system deployment system. A fix would be great. I am here if you need any info from me. BTW, the image I captured with wimlib was called with the "--check" parameter just to make sure the image was ok, which I assume it would have to be... Here are the commands which perform the installation process by applying the wim and contain the point of failure. Remember, this works perfectly when using microsoft deployment tools, like DISM:
Broken:
call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

rem == Apply the image to the Windows partition ==
X:\Users\Administrator\Desktop\wimlib\wimlib-imagex.exe apply Z:\wimlibcapt.wim W:

rem == Copy boot files to the System partition ==
W:\Windows\System32\bcdboot W:\Windows /s S:

:rem == Copy the Windows RE image to the
:rem Windows RE Tools partition ==
md R:\Recovery\WindowsRE
:rem Fails right here
xcopy /h W:\Windows\System32\Recovery\Winre.wim R:\Recovery\WindowsRE\

:rem == Register the location of the recovery tools ==
W:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target W:\Windows

:rem == Verify the configuration status of the images. ==
W:\Windows\System32\Reagentc /Info /Target W:\Windows


Works:
call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c

rem == Apply the image to the Windows partition ==
dism /Apply-Image /ImageFile:Z:\wimlibcapt.wim /Index:1 /ApplyDir:W:\

rem == Copy boot files to the System partition ==
W:\Windows\System32\bcdboot W:\Windows /s S:

:rem == Copy the Windows RE image to the
:rem Windows RE Tools partition ==
md R:\Recovery\WindowsRE
xcopy /h W:\Windows\System32\Recovery\Winre.wim R:\Recovery\WindowsRE\

:rem == Register the location of the recovery tools ==
W:\Windows\System32\Reagentc /Setreimage /Path R:\Recovery\WindowsRE /Target W:\Windows

:rem == Verify the configuration status of the images. ==
W:\Windows\System32\Reagentc /Info /Target W:\Windows
synchronicity
Site Admin
Posts: 474
Joined: Sun Aug 02, 2015 10:31 pm

Re: Where is Winre.wim going?

Post by synchronicity »

Can you double check that the WIM image you're applying actually contains a file '\Windows\System32\Recovery\Winre.wim' and that you're applying the correct image? Note that a single WIM file can contain multiple images, identified by 1-based index or name.
whiggs
Posts: 3
Joined: Mon Jan 16, 2017 12:04 am

Re: Where is Winre.wim going?

Post by whiggs »

I don't think I was clear before, and I apologize. The issue is that the image DOESN'T contain the file. But it should, as the "Winre.wim" file is what allows you to boot into your recovery environment:
Image

Without it, if you try to boot into Windows recovery environment, it tells you to insert operating system install media. That is the source of my concern: when (whichever operation, if not both causes the missing file) captures and/or applications of wim files are performed with Microsoft tools, the winre.wim file is there. However, this is not the case when using wimlib. And the file itself, for your reference, has the "H" (hidden) and "S" (system) attributes assigned to it, meaning that, in the folder options menu, the "Show hidden files. folders. and drives" option needs to be selected and "Hide protected operating system files (Recommended)" needs to be unchecked in order to see it if its there. One thing I did notice was, when extracting the file from a base "install.wim", the attributes did not carry over, so I had to manually assign the "hidden" and "system" attributes to the wim file.

EDIT: BTW, the scripts and methods that I have been using for scripting os deployments, captures, etc. are edited versions of samples that Microsoft has made available for people to reference, so it should work seamlessly.
https://technet.microsoft.com/en-us/lib ... 21890.aspx
synchronicity
Site Admin
Posts: 474
Joined: Sun Aug 02, 2015 10:31 pm

Re: Where is Winre.wim going?

Post by synchronicity »

Okay, then can you double check that the filesystem you are creating the image from actually has a file "\Windows\System32\Recovery\Winre.wim", and that the resulting WIM image then somehow *does not* have that file after wimlib captures it, as listed by the wimdir command?
abbodi86
Posts: 9
Joined: Wed Jan 11, 2017 4:14 pm

Re: Where is Winre.wim going?

Post by abbodi86 »

For the reference, "hidden" and "system" attributes are not required for winre.wim
in vanilla (not booted) image, it doesn't have them
they only get assigned if you boot to Audit/sysprep, then recaptured the OS image
whiggs
Posts: 3
Joined: Mon Jan 16, 2017 12:04 am

Re: Where is Winre.wim going?

Post by whiggs »

So I looked in the wim file itself and it was not there. Here is the process I performed which brought about the image: I ripped the install media for the latest version of Windows 10 to a bootable flash and installed. When it was finished, had machine restart in audit mode (by pressing CTRL + SHIFT + F3 at first OOBE screen), customize the operating system, then perform a sysprep /generalize /shutdown /unattend:unattend file. I actually have a hunch that the missing wim file might be due to the "unattend" file that I attached to the sysprepped image, as it would (if it were incorporated into install media rather than me just applying the wim and scripting the partitioning myself) automate the hard drive partitioning during the install process. Does the unattend file automatically perform the necessary actions with winre.wim, which is why it is missing from image? I checked another image (my windows server 2012 R2 image) which I did not sysprep with an unattend file and the winre.wim file is there. At this point, I am pretty sure that has to be the reason. Correct me if I'm wrong.
synchronicity
Site Admin
Posts: 474
Joined: Sun Aug 02, 2015 10:31 pm

Re: Where is Winre.wim going?

Post by synchronicity »

I can't help much with the processes you are describing as I am not too familiar with them. What I can say is that wimlib has no special behavior regarding the 'winre.wim' file. So if it is being created, deleted, copied, moved, or whatever it may be, then it's being done by something else not by wimlib. I am pretty sure that DISM has no special behavior regarding that file either.
Post Reply