Solved

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

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

808 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