Jump to content

2 partitions after restoring Image


Recommended Posts

How can i automize a bcdboot command when booting the client with USB Winpe Stick?

One is to make a .txt file where i create 2 partitions with the letters c and d. after creating this paritions and after restoring a image the command in the Windows\system32\bcdboot.exe d:\Windows must be given. This works i have tested it but how can i do this automatically? The diskpart i do automatically to call a txt file disk.txt with the diskpart /s command. POutting this in the startnet.cmd then it is solved. In MDT2010 is doesn't have to be solved because he makes that extra partition and takes care of Windows 7 booting partition but when i boot from USB stick then i must solve it as mentioned with startnet and disk.txt. But how do i automate the bcdboot command? so that i do not run this command when i restore a image thru the usb boot winpe stick?

Link to comment
Share on other sites


With your diskpart script, you still create the System partition, but do not assign it a drive letter. Assign C: to your OS partition. Then run BCDBOOT C:\Windows.

How are you currently scripting your install?

I have a startnet.cmd on the usb key so there appears a menu when bootting with usb stick in Winpe. Then when i choose a menu option like restore image off... then diskpart.txt is run to format the harddrive and making the partitions.

The question now is how to automate the bcdboot command, i cannot put it in the diskpart.txt?

Link to comment
Share on other sites

The question now is how to automate the bcdboot command, i cannot put it in the diskpart.txt?

No, but you can put it in StartNet.cmd, after the part invoking diskpart.

OT, but not much ;), if you want to "embed" the diskpart.txt into a batch looky here:

http://www.msfn.org/board/index.php?showtopic=126069&st=19

this way from startnet.cmd you can invoke another batch that contains BOTH the diskpart and the BCDBOOT commands. :unsure:

jaclaz

Link to comment
Share on other sites

The question now is how to automate the bcdboot command, i cannot put it in the diskpart.txt?

No, but you can put it in StartNet.cmd, after the part invoking diskpart.

OT, but not much ;), if you want to "embed" the diskpart.txt into a batch looky here:

http://www.msfn.org/board/index.php?showtopic=126069&st=19

this way from startnet.cmd you can invoke another batch that contains BOTH the diskpart and the BCDBOOT commands. :unsure:

jaclaz

Thx. But this looks very complicated. I have put this in my startnet.cmd:

:itw7

diskpart /s diskw7.txt

echo VOORBEELD: imagex /apply \\server\reminst\images\windows7\NAAM.wim 1 c:

bcdboot.exe D:\Windows

bcdboot.exe D:\Windows

goto end

However: in this way the bcdboot runs to fust because the image must be restored first before the bcdboot command. Can you give me a some what easyer example how i can put this in startnetcmd?

Link to comment
Share on other sites

However: in this way the bcdboot runs to fust because the image must be restored first before the bcdboot command. Can you give me a some what easyer example how i can put this in startnetcmd?

You can use

START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\NAAM.wim 1 c:

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

but cannot say if something needs to be "refreshed" after applying an image,:unsure:, maybe you need to add an additional "delay" or "timeout" or "wait" command, such as sleep.exe or similar:

http://www.911cd.net/forums/index.php?showtopic=3252&st=9

to give the OS the "time" to see that the image has been applied.

jaclaz

Link to comment
Share on other sites

However: in this way the bcdboot runs to fust because the image must be restored first before the bcdboot command. Can you give me a some what easyer example how i can put this in startnetcmd?

You can use

START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\NAAM.wim 1 c:

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

but cannot say if something needs to be "refreshed" after applying an image,:unsure:, maybe you need to add an additional "delay" or "timeout" or "wait" command, such as sleep.exe or similar:

http://www.911cd.net/forums/index.php?showtopic=3252&st=9

to give the OS the "time" to see that the image has been applied.

jaclaz

The problem is that the imagex command cannot run automatically. This command i must put manually because the name is different every time. I restore different images with different names.

Is it possible to show the menu in startnet.cmd then choosing a menu option from startnet which wil go to the :itw7 commands and then give in the imagex command manually, then when he is finished he jumps to another command in the startnet.cmd which starts the bcdboot (so after the imagex /apply command is manually given?)

Link to comment
Share on other sites

Oww, comeon ;):


SET Image_name=
:Loop
SET /P Image_name=Please Enter name of the image including the .wim extension
IF NOT DEFINED Image_name GOTO :Loop
IF NOT EXIST Image_name GOTO :Loop
START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\%Image_name% 1 c:
bcdboot.exe D:\Windows

jaclaz

Link to comment
Share on other sites

Oww, comeon ;):


SET Image_name=
:Loop
SET /P Image_name=Please Enter name of the image including the .wim extension
IF NOT DEFINED Image_name GOTO :Loop
IF NOT EXIST Image_name GOTO :Loop
START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\%Image_name% 1 c:
bcdboot.exe D:\Windows

jaclaz

This is looking nice i have two final questions:

c:bcdboot.exe d:\windows For me this must be i think: x:\windows\system32\bcdboot.exe d:\windows

What must i fill in by: "a title"?

Link to comment
Share on other sites

c:bcdboot.exe d:\windows For me this must be i think: x:\windows\system32\bcdboot.exe d:\windows

Probably no, cannot say if in the booted PE "x:\windows\system32\" is already in PATH , but I presume it is.

What must i fill in by: "a title"?

Try with:

"Next time I will read given links" ;)

:lol:

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

Notes:

Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes ""

According to the Microsoft documentation, the title is optional, but you may have problems if it is omitted.

jaclaz

Link to comment
Share on other sites

c:bcdboot.exe d:\windows For me this must be i think: x:\windows\system32\bcdboot.exe d:\windows

Probably no, cannot say if in the booted PE "x:\windows\system32\" is already in PATH , but I presume it is.

What must i fill in by: "a title"?

Try with:

"Next time I will read given links" ;)

:lol:

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

Notes:

Always include a TITLE this can be a simple string like "My Script" or just a pair of empty quotes ""

According to the Microsoft documentation, the title is optional, but you may have problems if it is omitted.

jaclaz

Yes i must do that am sorry?

But now the last question: is the start and the /wait command nessecairy? I can run imagex without it?

Link to comment
Share on other sites

But now the last question: is the start and the /wait command nessecairy? I can run imagex without it?

You'll have to do some experiments, there are a number of factors that can influence the way an invoked app will run, including the particular subset you are running (PE 3.x).

Using the Start /wait you are guranteed that the next BCDboot command will NOT be executed until the imagex has completed, as said, since it is likely that there will be timing problems, it is very possible that in ADDITION to the start /wait you will need to insert a command to have some small delay between the imagex and the bootbcd commands.

The only way to know is to experiment:

Life is "trying things to see if they work"

:thumbup

jaclaz

Link to comment
Share on other sites

Oww, comeon ;):


SET Image_name=
:Loop
SET /P Image_name=Please Enter name of the image including the .wim extension
IF NOT DEFINED Image_name GOTO :Loop
IF NOT EXIST Image_name GOTO :Loop
START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\%Image_name% 1 c:
bcdboot.exe D:\Windows

jaclaz

This is looking nice i have two final questions:

c:bcdboot.exe d:\windows For me this must be i think: x:\windows\system32\bcdboot.exe d:\windows

What must i fill in by: "a title"?

I have a problem to get this to work. The code above stays in a loop. I do a netuse before running the above code to the share where the image's are. The he asks for a image name incl .wim extension. When i fill in the name he keeps asking for the .wim file so he is in a :loop. The name for the image is correct, the share netuse is completed successfully.

I have placed the :loop before SET Image_name= because i thought that could be the problem, but it aint.

What can be more wrong?

Link to comment
Share on other sites

I have a problem to get this to work. The code above stays in a loop. I do a netuse before running the above code to the share where the image's are. The he asks for a image name incl .wim extension. When i fill in the name he keeps asking for the .wim file so he is in a :loop. The name for the image is correct, the share netuse is completed successfully.

I have placed the :loop before SET Image_name= because i thought that could be the problem, but it aint.

What can be more wrong?

Well, you'll have to find out, try doing the obvious things:

SET Image_name= 
:Loop
SET /P Image_name=Please Enter name of the image including the .wim extension
PAUSE
SET %Image_name%
REM IF NOT DEFINED Image_name GOTO :Loop
REM IF NOT EXIST Image_name GOTO :Loop
ECHO START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\%Image_name% 1 c:
PAUSE
START "A_title" /WAIT imagex /apply \\server\reminst\images\windows7\%Image_name% 1 c:
bcdboot.exe D:\Windows

Edit:

Sorry, my bad :blushing:, there was a typo in:

IF NOT EXIST Image_name GOTO :Loop

it should be (obviously):

IF NOT EXIST %Image_name% GOTO :Loop 

and you may also need to change it to the "Full" path:

IF NOT EXIST \\server\reminst\images\windows7\%Image_name% GOTO :Loop 

jaclaz

Edited by jaclaz
Link to comment
Share on other sites

I would like that this is succeeding. This is what i have in my startnet.cmd:

diskpart /s diskw7.txt

net use \\server\reminst\images\windows7 /user:domain\loginname

SET Image_naam=

:Loop

SET /P %Image_naam%=Geef de naam in van de Image inclusief .wim extensie

SET %Image_naam%

IF NOT DEFINED \\server\reminst\images\windows7\%Image_naam% GOTO :Loop

IF NOT EXIST \\server\reminst\images\windows7\%Image_naam% GOTO :Loop

START "start" /WAIT imagex /apply \\server\reminst\images\windows7\%Image_naam% 1 c:

bcdboot.exe D:\Windows

goto end

The first command (net use) is succesfully.

After the set image_naam there is also no error.

Then this appears: Geef de naam in van de Image inclusief .wim extensie (= the set /p command)

After this he gives me a screen of text with computername, processorlevel, path and temp paths etc etc. Then the screen is appearing again:

Geef de naam in van de Image inclusief .wim extensie

And it starts over.

Could you give me some more advise?

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