Solved

Using Windows 7 OPK / WAIK and reagentc to create a hidden Windows RE Partition

Posted on 2010-08-31
3
1,951 Views
Last Modified: 2012-05-10
I'm trying to create a script to deploy a Windows 7 image en mass, and although it works there is one thing about it that's annoying me and I'm hoping there is a fix.  I am trying to setup a second recovery partition with the Windows RE image as well as the initial system image.  My deployment script and diskpart scripts (see attached) work as they are supposed to, but I'm wondering if there is any way to setup the recovery partition without having a mount point (ie I don't want it to show up as a drive letter).

Is there anyway using reagentc to set the setREimage and setOSimage image paths using disk\partition information instead of a drive letter?  If not, is there a different utility I should be using to achieve what I'm trying to do?  Thanks!
SELECT DISK 0
CLEAN
CREATE PARTITION PRIMARY SIZE=7000 ID=27
FORMAT QUICK FS=NTFS LABEL="Recovery"
ASSIGN LETTER="D"
CREATE PARTITION PRIMARY
FORMAT QUICK FS=NTFS LABEL="Win7_OS"
ASSIGN LETTER="C"
EXIT

Open in new window

@ECHO OFF
SET DISK=%1
SET WIM=%2
CLS
ECHO =====  Specify Source Drive and WIM File =====
IF /I "'%DISK%'"=="''" (
SET /P DISK=Diskpart Config File:  
GOTO WIM
)
ECHO Diskpart Config File:  %DISK%
:WIM
IF /I "'%WIM%'"=="''" (
SET /P WIM=Full Path to Source WIM:  
GOTO VERIFY
)
ECHO Source WIM:  %WIM%
:VERIFY
CLS
ECHO ===============================================================================
ECHO Source:  %WIM%
ECHO Destination:
ECHO ===============================================================================
TYPE %DISK%
ECHO ===============================================================================
ECHO Continuing this program will DESTROY ALL DATA on the drive specified in the
ECHO above disk partitioning script above and then deploy the WIM image specified.
ECHO.
ECHO If the above information is not accurate, or you wish to abort press Ctrl + C
ECHO.
PAUSE
CLS
ECHO Beginning Disk Partitioning...
diskpart /s %DISK%
ECHO.
ECHO Applying WIM image...
imagex /apply %WIM% 1 c:
ECHO.
ECHO Modifying BCD...
bcdboot C:\Windows
ECHO.
ECHO Creating Recovery Partition...
mkdir D:\Recovery\WindowsRE
copy C:\Windows\System32\Recovery\winre.wim D:\Recovery\WindowsRE\
copy %WIM% D:\Recovery\WindowsRE\install.wim
ECHO.
ECHO Adding Recovery Options to F8 Menu...
C:\Windows\System32\reagentc /setREimage /path D:\Recovery\WindowsRE /target C:\Windows
C:\Windows\System32\reagentc /setOSimage /path D:\Recovery\WindowsRE /target C:\Windows
ECHO.
ECHO DONE!
ECHO.

Open in new window

0
Comment
Question by:swallsvcs
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:SPC_75
ID: 33574628
either modify the code so that yuo don't need:
ASSIGN LETTER="D"


or Add the line:
REMOVE LETTER D
when the script has finished
0
 
LVL 4

Accepted Solution

by:
SPC_75 earned 500 total points
ID: 33574718
Actually, the best method using you code seems to be to create a different diskpart script using the following commands:

list volume
Which will look something like the first snippet.
Then type: select volume 0
Then type remove letter X

(subbing in the appropriate values for X and 0)

Ideally you don't need to list the volumes, that just to work out which is which so you can integrate it into your script. I'd guess 0 for you as well since D is actually created first but i'm not 100% on that one.

So the final code should look like this:

SELECT DISK 0
select volume 0
remove letter X
EXIT

-SPC
Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  -------
  Volume 0     X                       DVD-ROM         0 B  No Media
  Volume 1     Y                       DVD-ROM         0 B  No Media
  Volume 2     Z                       DVD-ROM         0 B  No Media
  Volume 3     C                NTFS   Partition   1192 GB  Healthy    System

Open in new window

0
 
LVL 4

Author Comment

by:swallsvcs
ID: 33580466
Thanks!  At first I was afraid this wouldn't work because reagentc specifies the drive letter as part of the command... but I notice that the actual result is saving the \\disk\partition path to the BCD so this works perfectly.  Sleepy eyes last night :)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question