?
Solved

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

Posted on 2010-08-31
3
Medium Priority
?
1,977 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.

777 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