Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

Anyone here with experience using WindowsRE and Reagentc?


  • Please log in to reply
15 replies to this topic

#1
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

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, 08 August 2013 - 08:13 AM.



How to remove advertisement from MSFN

#2
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,419 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

#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/...via-f8-startup/

starting more or less from here:

http://www.msfn.org/...artup/?p=950814

 

jaclaz



#3
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

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?

Attached Files



#4
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,419 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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



#5
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

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?



#6
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,817 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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/...ition/?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.


MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#7
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

 

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/...ition/?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?



#8
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,817 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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/...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


MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#9
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,419 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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



#10
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

 

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?



#11
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

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, 12 August 2013 - 11:42 AM.


#12
jaclaz

jaclaz

    The Finder

  • Developer
  • 14,419 posts
  • Joined 23-July 04
  • OS:none specified
  • Country: Country Flag

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.ntlw...ard-litany.html

 

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

 

jaclaz



#13
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

Here you go.

Attached Files


Edited by gotenks98, 12 August 2013 - 01:12 PM.


#14
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,817 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

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.


MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg

#15
gotenks98

gotenks98

    Member

  • Member
  • PipPip
  • 162 posts
  • Joined 02-June 05

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?



#16
Tripredacus

Tripredacus

    K-Mart-ian Legend

  • Super Moderator
  • 9,817 posts
  • Joined 28-April 06
  • OS:Server 2012
  • Country: Country Flag

Donator

WinRE in Windows 7 will locate where the Windows installation is, create Windows.old and copy everything into that directory. Then it will reinstall Windows using the answer file and the install.wim onto that partition. It doesn't change anything with the partitions, which would still allow WinRE to be run again.

 

I've not seen a case where diskpart needs to be run prior to running setup.


MSFN RULES | GimageX HTA for PE 3-5 | lol probloms
msfn2_zpsc37c7153.jpg




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users



How to remove advertisement from MSFN