Solved

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

Posted on 2010-08-31
3
1,926 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
  • 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
You may have a outside contractor who comes in once a week or seasonal to do some work in your office but you only want to give him access to the programs and files he needs and keep privet all other documents and programs, can you do this on a loca…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

932 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now