Jump to content

Anyone here with experience using WindowsRE and Reagentc?


Recommended Posts

I have been struggling for the past 3 weeks trying to come up with a recovery solution for our loaner program so I dont have to reimage machines so often. What I wanted to do is capture an image, sysprep it, and have a bunch of scripts that run to install apps and install drivers using dpinst. When I capture the wim file I want to use it as the recovery image by setting it with reagent.exe . I want to then capture an image of the image (wim file within wim file) so that during windows setup when I do the initial image of the machine it does an apply of the first OOBE captured wim on the c: drive and apply of the recovery partition which is the r: drive which will be hidden from the user.

I have ran into a few issues with this.

Problem #1 my script to delete the directory that has the following issue, it keeps saying that there are empty folders which can not be deleted. These are folders that contained drivers that were used in the dpinst step

Problem #2 after the first initial boot up and factory reset after log in the factory reset no longer uses my answer file that was used in sysprep. I am not sure whats going on here so I even tried putting the autounattend.xml in the root of the c: and it still gets ignored when the factory reset is done.

Problem #3 I can not figure out where the reagentc.exe file writes to. If I am going to make a image with dism I need a way to make it so upon applying both index images I dont have to do the setreimage and setosimage commands again.

Problem #4 I am not sure how I can set the id value of the disk to 27 and still make it so that the reagentc.exe finds the winre and install.wim files. My thoughts are that once I set it to hidden with diskpart it wont find the recovery options.

Small Edit

Problem #5 In the past I used to use firstlogoncommands and I would get this nice little check list in the upper left corner that says what has installed or succeeded. However since MS changed from the WAIK to the ADK I have not been able to get this to work again. Instead of installing applications one at a time, It just fires off all the executables at once instead of waiting for the first one to finish. I have had to switch to doing this via the setupcomplete.cmd batch file which is called in the autounattend.xml under firstlogoncommands. I just wish there was a way to change this back and have it to still work.

Any ideas on how to solve these issues?

Edited by gotenks98
Link to comment
Share on other sites


#1 unless you post your script (or the relevant part of it) it is improbable that someone can guess the reason why it doesn't delete those empty directories.

#4 The Partition ID of 27 does not mean "hidden NTFS" (that would be ID 17) it means "special NTFS partition". The way the ID 27 is evaluated may depend, but it is not "hidden", it is actually interpreted generally as "do not assign automatically a drive letter to it" and - just as an example - the 100 Mb partition created by Windows 7 on a "clean" install is also "27".

Some (generic), not necessarily useful to your issues, notes/ideas/reports are in this thread:

http://www.msfn.org/board/topic/128727-cant-access-repair-my-pc-option-via-f8-startup/

starting more or less from here:

http://www.msfn.org/board/topic/128727-cant-access-repair-my-pc-option-via-f8-startup/?p=950814

jaclaz

Link to comment
Share on other sites

I have attached my autounattend.xml and my setupcomplete command. Originally I had the autounattend.xml file to call the setupcomplete.cmd but I still got the same issue of the deleting directory still saying that the directories are empty. Also I still need to know where the files that reagenct edits gets stored so I know what to do to ensure my recovery image works. Maybe I need another script that sets this during windows setup?

autounattend.xml

setupcomplete.cmd

Link to comment
Share on other sites

I downloaded the setupcomplete.cmd. (and the autounattend.xml)

Please consider how one should NEVER post a .exe, .com, .bat or .cmd "directly", but ALWAYS put them into an archive (.zip or .7z) as someone may inadvertently double click/execute them.

In a nutshell it is this snippet, right?

<SynchronousCommand wcm:action="add">                    <CommandLine>cmd /c start /wait rd c:\apps /q /s</CommandLine>                    <Description>Cleaning Up Directories</Description>                    <Order>98</Order>                    <RequiresUserInput>true</RequiresUserInput>                </SynchronousCommand>

The syntax for RD is:

http://ss64.com/nt/rd.html

RD [switches] <pathname>

i.e.:

RD /S /Q <pathname>

and not

RD <pathname>  /Q /S

see if that is the issue.

jaclaz

Link to comment
Share on other sites

Sorry about that with the cmd file. I also have tried it both ways with the /s /q before and after the path. What I found is that I spelled autounattend wrong on one instance of this script. However now I am noticing that it wants to delete the directories before all the other lines of the script are finished. The delete directory command is at the end of the script. I have even tried moving the delete command to the autounattend file instead of being done at the setup complete. Is there some catch to making these commands go in and order and not execute to the previous one is finished. I thought that was the whole point of the firstlogoncommands synchronous. Maybe I am doing something wrong with the start /wait commands?

Link to comment
Share on other sites

Problem #2 after the first initial boot up and factory reset after log in the factory reset no longer uses my answer file that was used in sysprep. I am not sure whats going on here so I even tried putting the autounattend.xml in the root of the c: and it still gets ignored when the factory reset is done.

Problem #3 I can not figure out where the reagentc.exe file writes to. If I am going to make a image with dism I need a way to make it so upon applying both index images I dont have to do the setreimage and setosimage commands again.

Problem #4 I am not sure how I can set the id value of the disk to 27 and still make it so that the reagentc.exe finds the winre and install.wim files. My thoughts are that once I set it to hidden with diskpart it wont find the recovery options.

2. WinRE uses Setup.exe to apply the recovery image. Indeed it doesn't seem to care about the answer file used if one was applied with sysprep prior to capturing the image. Take a look here:

http://www.msfn.org/board/topic/142990-installing-windows-7-from-recovery-partition/?p=918385

3. Reagentc commands are written to where your BCD is located.

4. You use Diskpart to set the partition ID after you run the Reagentc commands.

Link to comment
Share on other sites

Problem #2 after the first initial boot up and factory reset after log in the factory reset no longer uses my answer file that was used in sysprep. I am not sure whats going on here so I even tried putting the autounattend.xml in the root of the c: and it still gets ignored when the factory reset is done.

Problem #3 I can not figure out where the reagentc.exe file writes to. If I am going to make a image with dism I need a way to make it so upon applying both index images I dont have to do the setreimage and setosimage commands again.

Problem #4 I am not sure how I can set the id value of the disk to 27 and still make it so that the reagentc.exe finds the winre and install.wim files. My thoughts are that once I set it to hidden with diskpart it wont find the recovery options.

2. WinRE uses Setup.exe to apply the recovery image. Indeed it doesn't seem to care about the answer file used if one was applied with sysprep prior to capturing the image. Take a look here:

http://www.msfn.org/board/topic/142990-installing-windows-7-from-recovery-partition/?p=918385

3. Reagentc commands are written to where your BCD is located.

4. You use Diskpart to set the partition ID after you run the Reagentc commands.

Yes this is exactly what I am looking for on my issues. So if I open the Winre.wim and put in my xml file in the proper place will it use that instead? I am a little confused about this factoryrecoverytool Is this something you created or is it just named that? Also if say I am doing my initial imaging to a machine using normal windows setup from a usb drive how or where would I script to in the xml file to set the reagentc commands?

Link to comment
Share on other sites

No it won't use it automatically. Hence in my example (it is not 100% spelled out in the post but I am limited) I had to create the custom option that runs setup using the /unattend switch. The custom option is the 6th item shown in RECENV, which you can see an example here as "Recovery Manager".

http://www.msfn.org/board/topic/163632-computer-will-not-boot/?p=1046788

FactoryRecoveryTool is in WinRE. For deployments it is a little tricky and I'm not particularly fond of doing it. What you end up doing is take your image you made, mount it. Mount the winre.wim that is inside of that, put in the XML file and make the Tools folder. Then unmount the winre.wim then unmount the install.wim. Then you can deploy that image.

You don't call reagentc from XML. It happens during deployment. So its like this:

- prepare parts with diskpart

- apply image with DISM

- run reagentc commands

- set disk id with diskpart

- reboot

Link to comment
Share on other sites

I also have tried it both ways with the /s /q before and after the path. What I found is that I spelled autounattend wrong on one instance of this script. However now I am noticing that it wants to delete the directories before all the other lines of the script are finished. The delete directory command is at the end of the script. I have even tried moving the delete command to the autounattend file instead of being done at the setup complete.

I don't know. :w00t:

Evidently you are doing various experiments :) but what you need to post is a "sinchronized" set of two files (the autounattend.xml and the .cmd) and express your perplexities/doubts/resulting issues/whatever referred to that exact set (and not to the ones you have on your machine and that you have in the meantime changed n times).

Remember that every time someone trying to help you has to guess something (besides the unfair additional effort he has to bear) it is more likely that you will be sent on a wild goose chase instead of the direction where the solution is.

jaclaz

Link to comment
Share on other sites

I also have tried it both ways with the /s /q before and after the path. What I found is that I spelled autounattend wrong on one instance of this script. However now I am noticing that it wants to delete the directories before all the other lines of the script are finished. The delete directory command is at the end of the script. I have even tried moving the delete command to the autounattend file instead of being done at the setup complete.

I don't know. :w00t:

Evidently you are doing various experiments :) but what you need to post is a "sinchronized" set of two files (the autounattend.xml and the .cmd) and express your perplexities/doubts/resulting issues/whatever referred to that exact set (and not to the ones you have on your machine and that you have in the meantime changed n times).

Remember that every time someone trying to help you has to guess something (besides the unfair additional effort he has to bear) it is more likely that you will be sent on a wild goose chase instead of the direction where the solution is.

jaclaz

Sorry I meant to post a reply about this sooner but my system crashed before I could post it earlier. For the script I had to put it as cmd /c start /b /wait then the command. What was happening is that it was opening a another cmd window which the system thinks the other command has terminated and goes on to the next step. If I put a /b there it does not. I am getting very close to finishing this now. I just need to figure out the xml part that configures the recovery to use the unattend file. I just need to know the syntax of the WinREConfig.xml file. I do have another question but its MDT related. Does any know if MDT can deploy multiple partitions from an image file? Like say my sys prep wim file and my image of the recovery partition to a specific partition?

Link to comment
Share on other sites

I need a little more help with this. I think I figured out how to get it to run the setup and use my answer file. I am checking it in a vm now as we speak. What is left to do is how do I set this up to do a disk part that formats partitions one and three, and then run setup? When I tried this the only thing that happens is diskpart runs but none of the commands do. Also is there a way to change the icon of what you click on to start the reinstall? Currently it says unknown and thats it. I had a few issues with getting it to run with an answer file but that was due to the /flag for enterprise not being set in the image.

Ok scratch that, unattend.xml file still not being read by setup.exe despite using the /unattend flag.

Edited by gotenks98
Link to comment
Share on other sites

Again, IF you provide the EXACT and COMPLETE *whatever* sets of files/settings that currently do not work for you , THEN possibly someone can have a look at them and (hopefully :)) point out what is "wrong" with them.

Otherwise it would be (educated or wild :ph34r:) guessing (and a not-so-trifling waste of time with possibly no useful result :no:).

See if this clears the matters:

http://homepage.ntlworld.com./jonathan.deboynepollard/FGA/problem-report-standard-litany.html

You are seemingly (still) at the "I'm ill, doctor. Help!". :w00t:

jaclaz

Link to comment
Share on other sites

Here is an example WinREConfig.xml:

<?xml version='1.0' encoding='utf-8'?><Recovery>    <FactoryRecoveryTool>       <RelativeFilePath>..\..\setup.exe</RelativeFilePath>       <CommandLineParam>/UNATTEND:X:\sources\UNATTEND.XML</CommandLineParam>       <AdminOnly>No</AdminOnly>    </FactoryRecoveryTool></Recovery>

I never made any changes to ReAgent.xml, is that unmodified from the one that already exists?

As far as the icon goes, you can't change it if you are specifying your custom tool to be Setup.exe. It just uses that applications default icon. Also remember that there are 2 setup.exes in winre.wim.

Link to comment
Share on other sites

What about a diskpart command followed by setup .exe?

Diskpart

Select disk 0

Select partition 1

format fs=ntfs quick

assign letter=h (only assigning a letter to move this from c: to h: so c: can be used for windows)

active

select partition 3

format fs=ntfs quick

assign letter=c

exit

setup.exe /unattend:x:\unattend.xml

put my script as Format and Install.cmd in the root directory of the x: drive

From there I point the Winreconfig.xml to this file instead of setup.exe?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...